diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-05-04 16:27:36 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2011-05-05 14:22:56 (GMT) |
commit | 5b356ab162c58442a5e08868412af1b2b65b3f5c (patch) | |
tree | 35742bb2e77cfeca0a7e0411d8fd84f4eb35e07e /src/network/access | |
parent | b166c30d8d0834518337ded44d2ebfe097ee312f (diff) | |
download | Qt-5b356ab162c58442a5e08868412af1b2b65b3f5c.zip Qt-5b356ab162c58442a5e08868412af1b2b65b3f5c.tar.gz Qt-5b356ab162c58442a5e08868412af1b2b65b3f5c.tar.bz2 |
Send User-Agent from the network request in http proxy CONNECT command
Some proxies can discriminate based on the User-Agent when sent a
CONNECT command for establishing a HTTPS connection.
With this change, if the User-Agent header is set in the QNetworkRequest
then it will be passed to the http socket engine for use in the connect
command sent to the proxy.
As before, "Mozilla/5.0" will be used by default when no user agent
has been set.
Task-number: QTBUG-17223
Reviewed-by: Markus Goetz
Diffstat (limited to 'src/network/access')
-rw-r--r-- | src/network/access/qhttpnetworkconnectionchannel.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 6fbc6f8..b738ccf 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -579,6 +579,12 @@ bool QHttpNetworkConnectionChannel::ensureConnection() connectHost = connection->d_func()->networkProxy.hostName(); connectPort = connection->d_func()->networkProxy.port(); } + if (socket->proxy().type() == QNetworkProxy::HttpProxy) { + // Make user-agent field available to HTTP proxy socket engine (QTBUG-17223) + QByteArray value = request.headerField("user-agent"); + if (!value.isEmpty()) + socket->setProperty("_q_user-agent", value); + } #endif if (ssl) { #ifndef QT_NO_OPENSSL |