diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2011-10-13 19:56:28 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-30 01:19:59 +0200 |
commit | 74d2dba46041448c70dbd3049ae2a8277770baf6 (patch) | |
tree | b7745d6387b86768b85a5e772dd654cb91412aa8 /src/network/access/qhttpthreaddelegate.cpp | |
parent | 8cf66c3bc4482bbefad90ce7ad34ac6c3de8478f (diff) |
Port to the new QUrl API
The use of any broken-down components of the query now needs
QUrlQuery.
The QUrl constructor and toString() are now rehabilitated and the
preferred forms. Use toEncoded() and fromEncoded() now only when we
need to store data in a QByteArray or the data comes from a QByteArray
anyway. Change to toString() or the constructor if the data was in a
QString.
Change-Id: I9d761a628bef9c70185a48e927a61779a1642342
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/network/access/qhttpthreaddelegate.cpp')
-rw-r--r-- | src/network/access/qhttpthreaddelegate.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp index c8b4c51e23..634340bb54 100644 --- a/src/network/access/qhttpthreaddelegate.cpp +++ b/src/network/access/qhttpthreaddelegate.cpp @@ -105,12 +105,12 @@ static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const static QByteArray makeCacheKey(QUrl &url, QNetworkProxy *proxy) { - QByteArray result; + QString result; QUrl copy = url; bool isEncrypted = copy.scheme().toLower() == QLatin1String("https"); copy.setPort(copy.port(isEncrypted ? 443 : 80)); - result = copy.toEncoded(QUrl::RemoveUserInfo | QUrl::RemovePath | - QUrl::RemoveQuery | QUrl::RemoveFragment); + result = copy.toString(QUrl::RemoveUserInfo | QUrl::RemovePath | + QUrl::RemoveQuery | QUrl::RemoveFragment | QUrl::FullyEncoded); #ifndef QT_NO_NETWORKPROXY if (proxy && proxy->type() != QNetworkProxy::NoProxy) { @@ -134,15 +134,15 @@ static QByteArray makeCacheKey(QUrl &url, QNetworkProxy *proxy) key.setUserName(proxy->user()); key.setHost(proxy->hostName()); key.setPort(proxy->port()); - key.setEncodedQuery(result); - result = key.toEncoded(); + key.setQuery(result); + result = key.toString(QUrl::FullyEncoded); } } #else Q_UNUSED(proxy) #endif - return "http-connection:" + result; + return "http-connection:" + result.toLatin1(); } class QNetworkAccessCachedHttpConnection: public QHttpNetworkConnection, @@ -386,7 +386,7 @@ void QHttpThreadDelegate::finishedSlot() // it's an error reply QString msg = QLatin1String(QT_TRANSLATE_NOOP("QNetworkReply", "Error downloading %1 - server replied: %2")); - msg = msg.arg(QString::fromAscii(httpRequest.url().toEncoded()), httpReply->reasonPhrase()); + msg = msg.arg(httpRequest.url().toString(), httpReply->reasonPhrase()); emit error(statusCodeFromHttp(httpReply->statusCode(), httpRequest.url()), msg); } @@ -406,7 +406,7 @@ void QHttpThreadDelegate::synchronousFinishedSlot() // it's an error reply QString msg = QLatin1String(QT_TRANSLATE_NOOP("QNetworkReply", "Error downloading %1 - server replied: %2")); - incomingErrorDetail = msg.arg(QString::fromAscii(httpRequest.url().toEncoded()), httpReply->reasonPhrase()); + incomingErrorDetail = msg.arg(httpRequest.url().toString(), httpReply->reasonPhrase()); incomingErrorCode = statusCodeFromHttp(httpReply->statusCode(), httpRequest.url()); } |