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>
This commit is contained in:
Shane Kearns 2011-12-19 16:49:07 +00:00 committed by Qt by Nokia
parent 2edada763a
commit 9ffd69a6a6

View File

@ -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) {