Removing unnecessary hidden property "_q_user-agent".

This property is no longer necessary because we can now set the user
agent directly on the proxy.

Task-number: QTBUG-17223
Change-Id: I27cb126dd401f02525290d2317650f55cae9f4ef
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
This commit is contained in:
Jonas M. Gastal 2011-11-24 13:34:04 -02:00 committed by Qt by Nokia
parent 4cffc72023
commit c990f38a5d
4 changed files with 3 additions and 16 deletions

View File

@ -581,7 +581,7 @@ bool QHttpNetworkConnectionChannel::ensureConnection()
else
value = request.headerField("user-agent");
if (!value.isEmpty())
socket->setProperty("_q_user-agent", value);
socket->proxy().setRawHeader("User-Agent", value);
}
#endif
if (ssl) {

View File

@ -594,10 +594,6 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc
#ifndef QT_NO_BEARERMANAGEMENT
//copy network session down to the socket engine (if it has been set)
socketEngine->setProperty("_q_networksession", q->property("_q_networksession"));
#endif
#ifndef QT_NO_NETWORKPROXY
//copy user agent to socket engine (if it has been set)
socketEngine->setProperty("_q_user-agent", q->property("_q_user-agent"));
#endif
if (!socketEngine->initialize(q->socketType(), protocol)) {
#if defined (QABSTRACTSOCKET_DEBUG)

View File

@ -504,15 +504,8 @@ void QHttpSocketEngine::slotSocketConnected()
data += " HTTP/1.1\r\n";
data += "Proxy-Connection: keep-alive\r\n";
data += "Host: " + peerAddress + "\r\n";
if (!d->proxy.hasRawHeader("User-Agent")) {
data += "User-Agent: ";
QVariant v = property("_q_user-agent");
if (v.isValid())
data += v.toByteArray();
else
data += "Mozilla/5.0";
data += "\r\n";
}
if (!d->proxy.hasRawHeader("User-Agent"))
data += "User-Agent: Mozilla/5.0\r\n";
foreach (const QByteArray &header, d->proxy.rawHeaderList()) {
data += header + ": " + d->proxy.rawHeader(header) + "\r\n";
}

View File

@ -1749,8 +1749,6 @@ void QSslSocket::connectToHostImplementation(const QString &hostName, quint16 po
}
#ifndef QT_NO_NETWORKPROXY
d->plainSocket->setProxy(proxy());
//copy user agent down to the plain socket (if it has been set)
d->plainSocket->setProperty("_q_user-agent", property("_q_user-agent"));
#endif
QIODevice::open(openMode);
d->plainSocket->connectToHost(hostName, port, openMode, d->preferredNetworkLayerProtocol);