From 32893fa9c45ad1a26a476f43711bdd5e6951e24b Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 25 Apr 2014 15:59:11 +0200 Subject: 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 Reviewed-by: Thiago Macieira --- src/network/access/qspdyprotocolhandler.cpp | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'src/network/access/qspdyprotocolhandler.cpp') 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())); -- cgit v1.2.3