summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorshiroki <shiroki@cuteqt.com>2011-05-25 09:26:23 (GMT)
committershiroki <shiroki@cuteqt.com>2011-05-25 09:26:23 (GMT)
commit1013cf05d579dbcf61890b5529a6e970aa562a19 (patch)
tree3dc21cf54e84d82071937415bb77e7d18a7904e6 /src/network
parentb001e886b35d06ca2551709280f0541cdc75c34a (diff)
downloadQt-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.cpp12
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) {