diff options
author | shiroki <shiroki@cuteqt.com> | 2011-05-25 09:11:51 (GMT) |
---|---|---|
committer | shiroki <shiroki@cuteqt.com> | 2011-05-25 09:15:53 (GMT) |
commit | 4ab5a2bc78e142d0035299090e3ad8bee81eed9f (patch) | |
tree | 211f877326d55d8d17c78ed7c372fc31327ca5c6 /src/network/access | |
parent | 00bf2e2605b97ff77efdcb68b7968375b3e9d195 (diff) | |
download | Qt-4ab5a2bc78e142d0035299090e3ad8bee81eed9f.zip Qt-4ab5a2bc78e142d0035299090e3ad8bee81eed9f.tar.gz Qt-4ab5a2bc78e142d0035299090e3ad8bee81eed9f.tar.bz2 |
fix "Host" header of ipv6 URLs in QNAM
Reviewed-by: Markus Goetz
Diffstat (limited to 'src/network/access')
-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 a471559..dd80a07 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -261,7 +261,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) { |