summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttpnetworkconnection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/access/qhttpnetworkconnection.cpp')
-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 33124fd..6101eea 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) {