diff options
Diffstat (limited to 'src')
-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) { |