From 9ffd69a6a6fd571826f904e95bc2264fa62e036e Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Mon, 19 Dec 2011 16:49:07 +0000 Subject: 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 --- src/network/access/qhttpnetworkconnectionchannel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/network/access') 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) { -- cgit v1.2.3