From baba87e49b249b05277bb29af3e54f70fcbb3520 Mon Sep 17 00:00:00 2001 From: Robert Hogan Date: Mon, 1 Nov 2010 12:44:47 +0100 Subject: QNAM: Do not cache network connections per username. If user information is present in the Url, QNetworkAccessHttpBackend will cache the connection with a key in the format of user@hostname. This causes the following tests in QtWebKit to fail: LayoutTests/http/tests/xmlhttprequest/re-login.html LayoutTests/http/tests/xmlhttprequest/re-login-async.html The tests call the same url with user1 credentials, no credentials, user 2 credentials and no credentials. In the second and fourth calls Qt should use the most recently stored credentials. For the fourth call it currently uses user1's credentials instead of user2's. This is because it retrieves the cached connection from the third call and uses the user/pass in that connection's authenticator - which is user1's. In order to retrieve the connection with the most recently used credentials userinfo should be removed when caching the connection in QNetworkAccessCache. This will allow Qt to retrieve the connection used in the third call, in fact the same cached connection for all four calls. Merge-request: 623 Reviewed-by: Markus Goetz --- src/network/access/qnetworkaccesshttpbackend.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 1d85f3a..3fb7924 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -72,7 +72,7 @@ static QByteArray makeCacheKey(QNetworkAccessHttpBackend *backend, QNetworkProxy QUrl copy = backend->url(); bool isEncrypted = copy.scheme().toLower() == QLatin1String("https"); copy.setPort(copy.port(isEncrypted ? DefaultHttpsPort : DefaultHttpPort)); - result = copy.toEncoded(QUrl::RemovePassword | QUrl::RemovePath | + result = copy.toEncoded(QUrl::RemoveUserInfo | QUrl::RemovePath | QUrl::RemoveQuery | QUrl::RemoveFragment); #ifndef QT_NO_NETWORKPROXY -- cgit v0.12