From 664dabb9afbb1d233a9b16a8f80f944cc01d4e7f Mon Sep 17 00:00:00 2001 From: Iain Merrick Date: Wed, 24 Nov 2010 10:38:33 +0000 Subject: Set useCachedCredentials to true on first auth request. This flag previously defaulted to false, but the Android CTS specifies that a "sufficient" implementation should return true on the first authentication request. (The second and subsequent auth requests aren't tested.) This CL sets the flag to true on the first authentication request for a given WebRequest, but false for subsequent requests (i.e., if the first attempt to authenticate failed). Using a counter rather than a flag in WebRequest for readability. "isFirstAuthRequest" would be a bit ambiguous as a member variable, but "authRequestCount" seems pretty clear. Change-Id: Id9baae4c30111f743e079f90940078b07498b168 --- WebKit/android/WebCoreSupport/WebRequest.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'WebKit/android/WebCoreSupport/WebRequest.cpp') diff --git a/WebKit/android/WebCoreSupport/WebRequest.cpp b/WebKit/android/WebCoreSupport/WebRequest.cpp index a165b8a..366c3c9 100644 --- a/WebKit/android/WebCoreSupport/WebRequest.cpp +++ b/WebKit/android/WebCoreSupport/WebRequest.cpp @@ -66,6 +66,7 @@ WebRequest::WebRequest(WebUrlLoaderClient* loader, const WebResourceRequest& web , m_url(webResourceRequest.url()) , m_userAgent(webResourceRequest.userAgent()) , m_loadState(Created) + , m_authRequestCount(0) { GURL gurl(m_url); @@ -86,6 +87,7 @@ WebRequest::WebRequest(WebUrlLoaderClient* loader, const WebResourceRequest& web , m_url(webResourceRequest.url()) , m_userAgent(webResourceRequest.userAgent()) , m_loadState(Created) + , m_authRequestCount(0) { } @@ -310,8 +312,11 @@ void WebRequest::OnAuthRequired(URLRequest* request, net::AuthChallengeInfo* aut ASSERT(m_loadState == Started, "OnAuthRequired called on a WebRequest not in STARTED state (state=%d)", m_loadState); scoped_refptr authInfoPtr(authInfo); + bool firstTime = (m_authRequestCount == 0); + ++m_authRequestCount; + m_urlLoader->maybeCallOnMainThread(NewRunnableMethod( - m_urlLoader.get(), &WebUrlLoaderClient::authRequired, authInfoPtr)); + m_urlLoader.get(), &WebUrlLoaderClient::authRequired, authInfoPtr, firstTime)); } // After calling Start(), the delegate will receive an OnResponseStarted -- cgit v1.1