summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttpnetworkconnectionchannel.cpp
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-05-05 16:03:14 +0100
committerMarkus Goetz <Markus.Goetz@nokia.com>2011-05-09 13:16:41 +0200
commit7dd503c62f9d7b58597e6b659fe3effe439ac16e (patch)
tree7076674e9c314d695241f62f27ebd3b1f1a23a56 /src/network/access/qhttpnetworkconnectionchannel.cpp
parent9c1293283e02e11525325153f4b85a0a23bfef9f (diff)
Update QTBUG-17223 for Qt 4.8
In Qt 4.7, http network requests are assigned to http connection channels before connecting the channel. In Qt 4.8, channels are connected "blind" as this gives a performance improvement in certain circumstances. On the assumption that User-Agent should be the same for all the requests being sent to the server in a given burst, we use the first queued request to set the user agent for a http proxy. Task-number: QTBUG-17223 Reviewed-by: Markus Goetz Reviewed-by: Martin Petersson
Diffstat (limited to 'src/network/access/qhttpnetworkconnectionchannel.cpp')
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index b738ccf361..f44010100f 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -581,7 +581,12 @@ bool QHttpNetworkConnectionChannel::ensureConnection()
}
if (socket->proxy().type() == QNetworkProxy::HttpProxy) {
// Make user-agent field available to HTTP proxy socket engine (QTBUG-17223)
- QByteArray value = request.headerField("user-agent");
+ QByteArray value;
+ // ensureConnection is called before any request has been assigned, but can also be called again if reconnecting
+ if (request.url().isEmpty())
+ value = connection->d_func()->predictNextRequest().headerField("user-agent");
+ else
+ value = request.headerField("user-agent");
if (!value.isEmpty())
socket->setProperty("_q_user-agent", value);
}