diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-12-19 16:49:07 +0000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-19 19:08:57 +0100 |
commit | 9ffd69a6a6fd571826f904e95bc2264fa62e036e (patch) | |
tree | 6d9d126213b5d5c5bf06c1c56d62c6908728c286 /src/network/access/qhttpnetworkconnectionchannel.cpp | |
parent | 2edada763af005367810dda09ca0cdb5adc494b9 (diff) |
Fix regression in user-agent setting of http proxy in a QNetworkRequest
Modifying the proxy causes a detach(), so the socket is still using
the unmodified proxy.
Changed this to setProxy() the modified one back to the socket.
Test case tst_QNetworkReply::httpProxyCommands()
Change-Id: I448c2f2ab43ce8d78bc6edb8261599bf67372676
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/network/access/qhttpnetworkconnectionchannel.cpp')
-rw-r--r-- | src/network/access/qhttpnetworkconnectionchannel.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 89873c086a..edf66ff1aa 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -580,8 +580,11 @@ bool QHttpNetworkConnectionChannel::ensureConnection() value = connection->d_func()->predictNextRequest().headerField("user-agent"); else value = request.headerField("user-agent"); - if (!value.isEmpty()) - socket->proxy().setRawHeader("User-Agent", value); + if (!value.isEmpty()) { + QNetworkProxy proxy(socket->proxy()); + proxy.setRawHeader("User-Agent", value); //detaches + socket->setProxy(proxy); + } } #endif if (ssl) { |