diff options
author | shiroki <shiroki@cuteqt.com> | 2011-05-25 09:26:23 (GMT) |
---|---|---|
committer | shiroki <shiroki@cuteqt.com> | 2011-05-25 09:26:23 (GMT) |
commit | 1013cf05d579dbcf61890b5529a6e970aa562a19 (patch) | |
tree | 3dc21cf54e84d82071937415bb77e7d18a7904e6 /src/network | |
parent | b001e886b35d06ca2551709280f0541cdc75c34a (diff) | |
download | Qt-1013cf05d579dbcf61890b5529a6e970aa562a19.zip Qt-1013cf05d579dbcf61890b5529a6e970aa562a19.tar.gz Qt-1013cf05d579dbcf61890b5529a6e970aa562a19.tar.bz2 |
fix the "Host" header for ipv6 URLs in QNAM
Reviewed-by: Markus Goetz
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qhttpnetworkconnection.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 61230fc..d76a5fd 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -256,7 +256,17 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) // set the host value = request.headerField("host"); if (value.isEmpty()) { - QByteArray host = QUrl::toAce(hostName); + QHostAddress add; + QByteArray host; + if(add.setAddress(hostName)) { + if(add.protocol() == QAbstractSocket::IPv6Protocol) { + host = "[" + hostName.toAscii() + "]";//format the ipv6 in the standard way + } else { + host = QUrl::toAce(hostName); + } + } else { + host = QUrl::toAce(hostName); + } int port = request.url().port(); if (port != -1) { |