summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qhttpsocketengine.cpp
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-05-04 16:27:36 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-05-05 13:01:24 (GMT)
commitcffec6c4fc1aed32ec9b3d9dd1f97105005385dc (patch)
tree5ccc8214e5674963e073084196141d65072886c5 /src/network/socket/qhttpsocketengine.cpp
parente8fc93973a41f193665baa5fdc26cba951bd692f (diff)
downloadQt-cffec6c4fc1aed32ec9b3d9dd1f97105005385dc.zip
Qt-cffec6c4fc1aed32ec9b3d9dd1f97105005385dc.tar.gz
Qt-cffec6c4fc1aed32ec9b3d9dd1f97105005385dc.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/socket/qhttpsocketengine.cpp')
-rw-r--r--src/network/socket/qhttpsocketengine.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index a338d97..cebff34 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -467,7 +467,13 @@ void QHttpSocketEngine::slotSocketConnected()
data += path;
data += " HTTP/1.1\r\n";
data += "Proxy-Connection: keep-alive\r\n"
- "User-Agent: Mozilla/5.0\r\n"
+ "User-Agent: ";
+ QVariant v = property("_q_user-agent");
+ if (v.isValid())
+ data += v.toByteArray();
+ else
+ data += "Mozilla/5.0";
+ data += "\r\n"
"Host: " + peerAddress + "\r\n";
QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(d->authenticator);
//qDebug() << "slotSocketConnected: priv=" << priv << (priv ? (int)priv->method : -1);