diff options
author | Peter Hartmann <phartmann@blackberry.com> | 2014-04-25 15:59:11 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-29 12:27:13 +0200 |
commit | 32893fa9c45ad1a26a476f43711bdd5e6951e24b (patch) | |
tree | 27db9e22b6806bcfdd28dddad78f09eb513c8052 /src/network/access | |
parent | c281755480a2d09f2eb96b4c97b4e7a389287e92 (diff) |
SPDY: use QUrl's logic for determining the correct "Host" header
... and not duplicate part of the logic in the SPDY code. This code was
also existent in QNetworkRequest.
The next step will be to actually respect the header if set via
QNetworkRequest::setRawHeader().
Change-Id: Ifda2658ea826d039c9dad61ed6fa42aaedaee6b6
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/network/access')
-rw-r--r-- | src/network/access/qspdyprotocolhandler.cpp | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp index 6d22ebeb35..d204d498bf 100644 --- a/src/network/access/qspdyprotocolhandler.cpp +++ b/src/network/access/qspdyprotocolhandler.cpp @@ -506,25 +506,7 @@ QByteArray QSpdyProtocolHandler::composeHeader(const QHttpNetworkRequest &reques #endif uncompressedHeader.append(headerField(":version", "HTTP/1.1")); - QHostAddress add; // ### unify with the host parsing from QHttpNetworkConnection - QByteArray host; - QString hostName = m_connection->hostName(); - if (add.setAddress(hostName)) { - if (add.protocol() == QAbstractSocket::IPv6Protocol) - host = "[" + hostName.toLatin1() + "]"; //format the ipv6 in the standard way - else - host = hostName.toLatin1(); - - } else { - host = QUrl::toAce(hostName); - } - - int port = request.url().port(); - if (port != -1) { - host += ':'; - host += QByteArray::number(port); - } - uncompressedHeader.append(headerField(":host", host)); + uncompressedHeader.append(headerField(":host", request.url().authority(QUrl::FullyEncoded | QUrl::RemoveUserInfo).toLatin1())); uncompressedHeader.append(headerField(":scheme", request.url().scheme().toLatin1())); |