diff options
24 files changed, 83 insertions, 50 deletions
diff --git a/net/http/http_auth.cc b/net/http/http_auth.cc index 540edf9..e63afcd 100644 --- a/net/http/http_auth.cc +++ b/net/http/http_auth.cc @@ -24,6 +24,7 @@ void HttpAuth::ChooseBestChallenge( const HttpResponseHeaders* headers, Target target, const GURL& origin, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler) { DCHECK(http_auth_handler_factory); @@ -36,7 +37,7 @@ void HttpAuth::ChooseBestChallenge( while (headers->EnumerateHeader(&iter, header_name, &challenge)) { ChallengeTokenizer props(challenge.begin(), challenge.end()); if (LowerCaseEqualsASCII(props.scheme(), (*handler)->scheme().c_str()) && - (*handler)->InitFromChallenge(&props, target, origin)) + (*handler)->InitFromChallenge(&props, target, origin, net_log)) return; } } @@ -49,7 +50,7 @@ void HttpAuth::ChooseBestChallenge( while (headers->EnumerateHeader(&iter, header_name, &cur_challenge)) { scoped_refptr<HttpAuthHandler> cur; int rv = http_auth_handler_factory->CreateAuthHandlerFromString( - cur_challenge, target, origin, &cur); + cur_challenge, target, origin, net_log, &cur); if (rv != OK) { LOG(WARNING) << "Unable to create AuthHandler. Status: " << ErrorToString(rv) << " Challenge: " << cur_challenge; diff --git a/net/http/http_auth.h b/net/http/http_auth.h index faa5e93..dd1d2df 100644 --- a/net/http/http_auth.h +++ b/net/http/http_auth.h @@ -11,6 +11,7 @@ template <class T> class scoped_refptr; namespace net { +class BoundNetLog; class HttpAuthHandler; class HttpAuthHandlerFactory; class HttpResponseHeaders; @@ -93,6 +94,7 @@ class HttpAuth { const HttpResponseHeaders* headers, Target target, const GURL& origin, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler); // ChallengeTokenizer breaks up a challenge string into the the auth scheme diff --git a/net/http/http_auth_handler.cc b/net/http/http_auth_handler.cc index 7c57cc7..661fc64 100644 --- a/net/http/http_auth_handler.cc +++ b/net/http/http_auth_handler.cc @@ -12,11 +12,13 @@ namespace net { bool HttpAuthHandler::InitFromChallenge( HttpAuth::ChallengeTokenizer* challenge, HttpAuth::Target target, - const GURL& origin) { + const GURL& origin, + const BoundNetLog& net_log) { origin_ = origin; target_ = target; score_ = -1; properties_ = -1; + net_log_ = net_log; auth_challenge_ = challenge->challenge_text(); bool ok = Init(challenge); @@ -31,8 +33,7 @@ bool HttpAuthHandler::InitFromChallenge( } int HttpAuthHandler::ResolveCanonicalName(net::HostResolver* host_resolver, - CompletionCallback* callback, - const BoundNetLog& net_log) { + CompletionCallback* callback) { NOTREACHED(); LOG(ERROR) << ErrorToString(ERR_NOT_IMPLEMENTED); return ERR_NOT_IMPLEMENTED; diff --git a/net/http/http_auth_handler.h b/net/http/http_auth_handler.h index 6f2cb50..8c01d41 100644 --- a/net/http/http_auth_handler.h +++ b/net/http/http_auth_handler.h @@ -9,11 +9,11 @@ #include "base/ref_counted.h" #include "net/base/completion_callback.h" +#include "net/base/net_log.h" #include "net/http/http_auth.h" namespace net { -class BoundNetLog; class HostResolver; class ProxyInfo; struct HttpRequestInfo; @@ -30,7 +30,8 @@ class HttpAuthHandler : public base::RefCounted<HttpAuthHandler> { // for later use, and are not part of the initial challenge. bool InitFromChallenge(HttpAuth::ChallengeTokenizer* challenge, HttpAuth::Target target, - const GURL& origin); + const GURL& origin, + const BoundNetLog& net_log); // Lowercase name of the auth scheme const std::string& scheme() const { @@ -121,8 +122,7 @@ class HttpAuthHandler : public base::RefCounted<HttpAuthHandler> { // SPN. // The return value is a net error code. virtual int ResolveCanonicalName(HostResolver* host_resolver, - CompletionCallback* callback, - const BoundNetLog& net_log); + CompletionCallback* callback); protected: enum Property { @@ -164,6 +164,8 @@ class HttpAuthHandler : public base::RefCounted<HttpAuthHandler> { // A bitmask of the properties of the authentication scheme. int properties_; + + BoundNetLog net_log_; }; } // namespace net diff --git a/net/http/http_auth_handler_basic.cc b/net/http/http_auth_handler_basic.cc index e8b812a..98bd02a 100644 --- a/net/http/http_auth_handler_basic.cc +++ b/net/http/http_auth_handler_basic.cc @@ -79,11 +79,12 @@ int HttpAuthHandlerBasic::Factory::CreateAuthHandler( const GURL& origin, CreateReason reason, int digest_nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler) { // TODO(cbentzel): Move towards model of parsing in the factory // method and only constructing when valid. scoped_refptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerBasic()); - if (!tmp_handler->InitFromChallenge(challenge, target, origin)) + if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) return ERR_INVALID_RESPONSE; handler->swap(tmp_handler); return OK; diff --git a/net/http/http_auth_handler_basic.h b/net/http/http_auth_handler_basic.h index 5b4806d..61816a3 100644 --- a/net/http/http_auth_handler_basic.h +++ b/net/http/http_auth_handler_basic.h @@ -23,6 +23,7 @@ class HttpAuthHandlerBasic : public HttpAuthHandler { const GURL& origin, CreateReason reason, int digest_nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler); }; diff --git a/net/http/http_auth_handler_basic_unittest.cc b/net/http/http_auth_handler_basic_unittest.cc index ee79d15..6e4599b 100644 --- a/net/http/http_auth_handler_basic_unittest.cc +++ b/net/http/http_auth_handler_basic_unittest.cc @@ -30,7 +30,7 @@ TEST(HttpAuthHandlerBasicTest, GenerateAuthToken) { std::string challenge = "Basic realm=\"Atlantis\""; scoped_refptr<HttpAuthHandler> basic = new HttpAuthHandlerBasic; EXPECT_EQ(OK, factory.CreateAuthHandlerFromString( - challenge, HttpAuth::AUTH_SERVER, origin, &basic)); + challenge, HttpAuth::AUTH_SERVER, origin, BoundNetLog(), &basic)); std::string credentials; int rv = basic->GenerateAuthToken(tests[i].username, tests[i].password, @@ -69,7 +69,7 @@ TEST(HttpAuthHandlerBasicTest, InitFromChallenge) { std::string challenge = tests[i].challenge; scoped_refptr<HttpAuthHandler> basic = new HttpAuthHandlerBasic; int rv = factory.CreateAuthHandlerFromString( - challenge, HttpAuth::AUTH_SERVER, origin, &basic); + challenge, HttpAuth::AUTH_SERVER, origin, BoundNetLog(), &basic); EXPECT_EQ(tests[i].expected_rv, rv); if (rv == OK) EXPECT_EQ(tests[i].expected_realm, basic->realm()); diff --git a/net/http/http_auth_handler_digest.cc b/net/http/http_auth_handler_digest.cc index 53edf06..86fab11 100644 --- a/net/http/http_auth_handler_digest.cc +++ b/net/http/http_auth_handler_digest.cc @@ -306,12 +306,13 @@ int HttpAuthHandlerDigest::Factory::CreateAuthHandler( const GURL& origin, CreateReason reason, int digest_nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler) { // TODO(cbentzel): Move towards model of parsing in the factory // method and only constructing when valid. scoped_refptr<HttpAuthHandler> tmp_handler( new HttpAuthHandlerDigest(digest_nonce_count)); - if (!tmp_handler->InitFromChallenge(challenge, target, origin)) + if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) return ERR_INVALID_RESPONSE; handler->swap(tmp_handler); return OK; diff --git a/net/http/http_auth_handler_digest.h b/net/http/http_auth_handler_digest.h index d575a40..dc29a0b 100644 --- a/net/http/http_auth_handler_digest.h +++ b/net/http/http_auth_handler_digest.h @@ -26,6 +26,7 @@ class HttpAuthHandlerDigest : public HttpAuthHandler { const GURL& origin, CreateReason reason, int digest_nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler); }; diff --git a/net/http/http_auth_handler_digest_unittest.cc b/net/http/http_auth_handler_digest_unittest.cc index 1b4130b..304656ff 100644 --- a/net/http/http_auth_handler_digest_unittest.cc +++ b/net/http/http_auth_handler_digest_unittest.cc @@ -254,7 +254,8 @@ TEST(HttpAuthHandlerDigestTest, AssembleCredentials) { scoped_refptr<HttpAuthHandlerDigest> digest = new HttpAuthHandlerDigest(1); std::string challenge = tests[i].challenge; HttpAuth::ChallengeTokenizer tok(challenge.begin(), challenge.end()); - EXPECT_TRUE(digest->InitFromChallenge(&tok, HttpAuth::AUTH_SERVER, origin)); + EXPECT_TRUE(digest->InitFromChallenge(&tok, HttpAuth::AUTH_SERVER, origin, + BoundNetLog())); std::string creds = digest->AssembleCredentials(tests[i].req_method, tests[i].req_path, diff --git a/net/http/http_auth_handler_factory.cc b/net/http/http_auth_handler_factory.cc index 7bb241f..e6d697f 100644 --- a/net/http/http_auth_handler_factory.cc +++ b/net/http/http_auth_handler_factory.cc @@ -19,10 +19,11 @@ int HttpAuthHandlerFactory::CreateAuthHandlerFromString( const std::string& challenge, HttpAuth::Target target, const GURL& origin, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler) { HttpAuth::ChallengeTokenizer props(challenge.begin(), challenge.end()); return CreateAuthHandler(&props, target, origin, CREATE_CHALLENGE, 1, - handler); + net_log, handler); } int HttpAuthHandlerFactory::CreatePreemptiveAuthHandlerFromString( @@ -30,10 +31,11 @@ int HttpAuthHandlerFactory::CreatePreemptiveAuthHandlerFromString( HttpAuth::Target target, const GURL& origin, int digest_nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler) { HttpAuth::ChallengeTokenizer props(challenge.begin(), challenge.end()); return CreateAuthHandler(&props, target, origin, CREATE_PREEMPTIVE, - digest_nonce_count, handler); + digest_nonce_count, net_log, handler); } // static @@ -87,6 +89,7 @@ int HttpAuthHandlerRegistryFactory::CreateAuthHandler( const GURL& origin, CreateReason reason, int digest_nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler) { if (!challenge->valid()) { *handler = NULL; @@ -100,7 +103,7 @@ int HttpAuthHandlerRegistryFactory::CreateAuthHandler( } DCHECK(it->second); return it->second->CreateAuthHandler(challenge, target, origin, reason, - digest_nonce_count, handler); + digest_nonce_count, net_log, handler); } HttpAuthHandlerFactory* HttpAuthHandlerRegistryFactory::GetSchemeFactory( diff --git a/net/http/http_auth_handler_factory.h b/net/http/http_auth_handler_factory.h index b3a1b8e..42a9ac4 100644 --- a/net/http/http_auth_handler_factory.h +++ b/net/http/http_auth_handler_factory.h @@ -16,6 +16,7 @@ class GURL; namespace net { +class BoundNetLog; class HttpAuthHandler; class HttpAuthHandlerRegistryFactory; @@ -72,6 +73,7 @@ class HttpAuthHandlerFactory { const GURL& origin, CreateReason create_reason, int digest_nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler) = 0; // Creates an HTTP authentication handler based on the authentication @@ -82,6 +84,7 @@ class HttpAuthHandlerFactory { int CreateAuthHandlerFromString(const std::string& challenge, HttpAuth::Target target, const GURL& origin, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler); // Creates an HTTP authentication handler based on the authentication @@ -94,6 +97,7 @@ class HttpAuthHandlerFactory { HttpAuth::Target target, const GURL& origin, int digest_nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler); // Creates a standard HttpAuthHandlerRegistryFactory. The caller is @@ -144,6 +148,7 @@ class HttpAuthHandlerRegistryFactory : public HttpAuthHandlerFactory { const GURL& origin, CreateReason reason, int digest_nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler); private: diff --git a/net/http/http_auth_handler_factory_unittest.cc b/net/http/http_auth_handler_factory_unittest.cc index 5293b89..2c2432f 100644 --- a/net/http/http_auth_handler_factory_unittest.cc +++ b/net/http/http_auth_handler_factory_unittest.cc @@ -21,6 +21,7 @@ class MockHttpAuthHandlerFactory : public HttpAuthHandlerFactory { const GURL& origin, CreateReason reason, int nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler) { *handler = NULL; return return_code_; @@ -50,39 +51,42 @@ TEST(HttpAuthHandlerFactoryTest, RegistryFactory) { // No schemes should be supported in the beginning. EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, registry_factory.CreateAuthHandlerFromString( - "Basic", HttpAuth::AUTH_SERVER, gurl, &handler)); + "Basic", HttpAuth::AUTH_SERVER, gurl, BoundNetLog(), &handler)); // Test what happens with a single scheme. registry_factory.RegisterSchemeFactory("Basic", mock_factory_basic); EXPECT_EQ(kBasicReturnCode, registry_factory.CreateAuthHandlerFromString( - "Basic", HttpAuth::AUTH_SERVER, gurl, &handler)); + "Basic", HttpAuth::AUTH_SERVER, gurl, BoundNetLog(), &handler)); EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, registry_factory.CreateAuthHandlerFromString( - "Digest", HttpAuth::AUTH_SERVER, gurl, &handler)); + "Digest", HttpAuth::AUTH_SERVER, gurl, BoundNetLog(), + &handler)); // Test multiple schemes registry_factory.RegisterSchemeFactory("Digest", mock_factory_digest); EXPECT_EQ(kBasicReturnCode, registry_factory.CreateAuthHandlerFromString( - "Basic", HttpAuth::AUTH_SERVER, gurl, &handler)); + "Basic", HttpAuth::AUTH_SERVER, gurl, BoundNetLog(), &handler)); EXPECT_EQ(kDigestReturnCode, registry_factory.CreateAuthHandlerFromString( - "Digest", HttpAuth::AUTH_SERVER, gurl, &handler)); + "Digest", HttpAuth::AUTH_SERVER, gurl, BoundNetLog(), + &handler)); // Test case-insensitivity EXPECT_EQ(kBasicReturnCode, registry_factory.CreateAuthHandlerFromString( - "basic", HttpAuth::AUTH_SERVER, gurl, &handler)); + "basic", HttpAuth::AUTH_SERVER, gurl, BoundNetLog(), &handler)); // Test replacement of existing auth scheme registry_factory.RegisterSchemeFactory("Digest", mock_factory_digest_replace); EXPECT_EQ(kBasicReturnCode, registry_factory.CreateAuthHandlerFromString( - "Basic", HttpAuth::AUTH_SERVER, gurl, &handler)); + "Basic", HttpAuth::AUTH_SERVER, gurl, BoundNetLog(), &handler)); EXPECT_EQ(kDigestReturnCodeReplace, registry_factory.CreateAuthHandlerFromString( - "Digest", HttpAuth::AUTH_SERVER, gurl, &handler)); + "Digest", HttpAuth::AUTH_SERVER, gurl, BoundNetLog(), + &handler)); } TEST(HttpAuthHandlerFactoryTest, DefaultFactory) { @@ -97,6 +101,7 @@ TEST(HttpAuthHandlerFactoryTest, DefaultFactory) { "Basic realm=\"FooBar\"", HttpAuth::AUTH_SERVER, server_origin, + BoundNetLog(), &handler); EXPECT_EQ(OK, rv); EXPECT_FALSE(handler.get() == NULL); @@ -112,6 +117,7 @@ TEST(HttpAuthHandlerFactoryTest, DefaultFactory) { "UNSUPPORTED realm=\"FooBar\"", HttpAuth::AUTH_SERVER, server_origin, + BoundNetLog(), &handler); EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, rv); EXPECT_TRUE(handler.get() == NULL); @@ -122,6 +128,7 @@ TEST(HttpAuthHandlerFactoryTest, DefaultFactory) { "Digest realm=\"FooBar\", nonce=\"xyz\"", HttpAuth::AUTH_PROXY, proxy_origin, + BoundNetLog(), &handler); EXPECT_EQ(OK, rv); EXPECT_FALSE(handler.get() == NULL); @@ -137,6 +144,7 @@ TEST(HttpAuthHandlerFactoryTest, DefaultFactory) { "NTLM", HttpAuth::AUTH_SERVER, server_origin, + BoundNetLog(), &handler); EXPECT_EQ(OK, rv); ASSERT_FALSE(handler.get() == NULL); @@ -153,6 +161,7 @@ TEST(HttpAuthHandlerFactoryTest, DefaultFactory) { "Negotiate", HttpAuth::AUTH_SERVER, server_origin, + BoundNetLog(), &handler); EXPECT_EQ(OK, rv); EXPECT_FALSE(handler.get() == NULL); @@ -169,6 +178,7 @@ TEST(HttpAuthHandlerFactoryTest, DefaultFactory) { "Negotiate", HttpAuth::AUTH_SERVER, server_origin, + BoundNetLog(), &handler); EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, rv); EXPECT_TRUE(handler.get() == NULL); diff --git a/net/http/http_auth_handler_negotiate.h b/net/http/http_auth_handler_negotiate.h index a9af8d4..6f2dab8 100644 --- a/net/http/http_auth_handler_negotiate.h +++ b/net/http/http_auth_handler_negotiate.h @@ -55,6 +55,7 @@ class HttpAuthHandlerNegotiate : public HttpAuthHandler { const GURL& origin, CreateReason reason, int digest_nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler); #if defined(OS_WIN) @@ -106,8 +107,7 @@ class HttpAuthHandlerNegotiate : public HttpAuthHandler { std::string* auth_token); virtual int ResolveCanonicalName(HostResolver* host_resolver, - CompletionCallback* callback, - const BoundNetLog& net_log); + CompletionCallback* callback); #if defined(OS_WIN) // These are public for unit tests diff --git a/net/http/http_auth_handler_negotiate_posix.cc b/net/http/http_auth_handler_negotiate_posix.cc index 270ee5b..3870e8f 100644 --- a/net/http/http_auth_handler_negotiate_posix.cc +++ b/net/http/http_auth_handler_negotiate_posix.cc @@ -69,9 +69,8 @@ bool HttpAuthHandlerNegotiate::NeedsCanonicalName() { return false; } -int HttpAuthHandlerNegotiate::ResolveCanonicalName(HostResolver* host_resolver, - CompletionCallback* callback, - const BoundNetLog& net_log) { +int HttpAuthHandlerNegotiate::ResolveCanonicalName( + HostResolver* host_resolver, CompletionCallback* callback) { NOTREACHED(); LOG(ERROR) << ErrorToString(ERR_NOT_IMPLEMENTED); return ERR_NOT_IMPLEMENTED; @@ -90,6 +89,7 @@ int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler( const GURL& origin, CreateReason reason, int digest_nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler) { return ERR_UNSUPPORTED_AUTH_SCHEME; } diff --git a/net/http/http_auth_handler_negotiate_unittest.cc b/net/http/http_auth_handler_negotiate_unittest.cc index ffb7ba4..ca54b47 100644 --- a/net/http/http_auth_handler_negotiate_unittest.cc +++ b/net/http/http_auth_handler_negotiate_unittest.cc @@ -29,7 +29,8 @@ void CreateHandler(bool disable_cname_lookup, bool include_port, std::string challenge = "Negotiate"; HttpAuth::ChallengeTokenizer props(challenge.begin(), challenge.end()); GURL gurl(url_string); - (*handler)->InitFromChallenge(&props, HttpAuth::AUTH_SERVER, gurl); + (*handler)->InitFromChallenge(&props, HttpAuth::AUTH_SERVER, gurl, + BoundNetLog()); } } // namespace @@ -69,8 +70,7 @@ TEST(HttpAuthHandlerNegotiateTest, CnameSync) { mock_resolver->rules()->AddIPv4Rule("alias", "10.0.0.2", "canonical.example.com"); TestCompletionCallback callback; - EXPECT_EQ(OK, auth_handler->ResolveCanonicalName(mock_resolver, &callback, - BoundNetLog())); + EXPECT_EQ(OK, auth_handler->ResolveCanonicalName(mock_resolver, &callback)); EXPECT_EQ(L"HTTP/canonical.example.com", auth_handler->spn()); } @@ -86,8 +86,7 @@ TEST(HttpAuthHandlerNegotiateTest, CnameAsync) { "canonical.example.com"); TestCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, auth_handler->ResolveCanonicalName(mock_resolver, - &callback, - BoundNetLog())); + &callback)); EXPECT_EQ(OK, callback.WaitForResult()); EXPECT_EQ(L"HTTP/canonical.example.com", auth_handler->spn()); } diff --git a/net/http/http_auth_handler_negotiate_win.cc b/net/http/http_auth_handler_negotiate_win.cc index 46266e2..4051ab5 100644 --- a/net/http/http_auth_handler_negotiate_win.cc +++ b/net/http/http_auth_handler_negotiate_win.cc @@ -83,9 +83,8 @@ bool HttpAuthHandlerNegotiate::NeedsCanonicalName() { return true; } -int HttpAuthHandlerNegotiate::ResolveCanonicalName(HostResolver* resolver, - CompletionCallback* callback, - const BoundNetLog& net_log) { +int HttpAuthHandlerNegotiate::ResolveCanonicalName( + HostResolver* resolver, CompletionCallback* callback) { // TODO(cbentzel): Add reverse DNS lookup for numeric addresses. DCHECK(!single_resolve_.get()); DCHECK(!disable_cname_lookup_); @@ -96,7 +95,7 @@ int HttpAuthHandlerNegotiate::ResolveCanonicalName(HostResolver* resolver, single_resolve_.reset(new SingleRequestHostResolver(resolver)); int rv = single_resolve_->Resolve(info, &address_list_, &resolve_cname_callback_, - net_log); + net_log_); if (rv == ERR_IO_PENDING) { user_callback_ = callback; return rv; @@ -197,6 +196,7 @@ int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler( const GURL& origin, CreateReason reason, int digest_nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler) { if (is_unsupported_ || reason == CREATE_PREEMPTIVE) return ERR_UNSUPPORTED_AUTH_SCHEME; @@ -214,7 +214,7 @@ int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler( new HttpAuthHandlerNegotiate(sspi_library_, max_token_length_, url_security_manager(), disable_cname_lookup_, use_port_)); - if (!tmp_handler->InitFromChallenge(challenge, target, origin)) + if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) return ERR_INVALID_RESPONSE; handler->swap(tmp_handler); return OK; diff --git a/net/http/http_auth_handler_ntlm.h b/net/http/http_auth_handler_ntlm.h index 5892191..d2eb7f8 100644 --- a/net/http/http_auth_handler_ntlm.h +++ b/net/http/http_auth_handler_ntlm.h @@ -46,6 +46,7 @@ class HttpAuthHandlerNTLM : public HttpAuthHandler { const GURL& origin, CreateReason reason, int digest_nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler); #if defined(NTLM_SSPI) // Set the SSPILibrary to use. Typically the only callers which need to diff --git a/net/http/http_auth_handler_ntlm_portable.cc b/net/http/http_auth_handler_ntlm_portable.cc index e16f791..fb6db5f 100644 --- a/net/http/http_auth_handler_ntlm_portable.cc +++ b/net/http/http_auth_handler_ntlm_portable.cc @@ -731,6 +731,7 @@ int HttpAuthHandlerNTLM::Factory::CreateAuthHandler( const GURL& origin, CreateReason reason, int digest_nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler) { if (reason == CREATE_PREEMPTIVE) return ERR_UNSUPPORTED_AUTH_SCHEME; @@ -739,7 +740,7 @@ int HttpAuthHandlerNTLM::Factory::CreateAuthHandler( // NOTE: Default credentials are not supported for the portable implementation // of NTLM. scoped_refptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNTLM); - if (!tmp_handler->InitFromChallenge(challenge, target, origin)) + if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) return ERR_INVALID_RESPONSE; handler->swap(tmp_handler); return OK; diff --git a/net/http/http_auth_handler_ntlm_win.cc b/net/http/http_auth_handler_ntlm_win.cc index 45d88de..160b981 100644 --- a/net/http/http_auth_handler_ntlm_win.cc +++ b/net/http/http_auth_handler_ntlm_win.cc @@ -76,6 +76,7 @@ int HttpAuthHandlerNTLM::Factory::CreateAuthHandler( const GURL& origin, CreateReason reason, int digest_nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler) { if (is_unsupported_ || reason == CREATE_PREEMPTIVE) return ERR_UNSUPPORTED_AUTH_SCHEME; @@ -92,7 +93,7 @@ int HttpAuthHandlerNTLM::Factory::CreateAuthHandler( scoped_refptr<HttpAuthHandler> tmp_handler( new HttpAuthHandlerNTLM(sspi_library_, max_token_length_, url_security_manager())); - if (!tmp_handler->InitFromChallenge(challenge, target, origin)) + if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) return ERR_INVALID_RESPONSE; handler->swap(tmp_handler); return OK; diff --git a/net/http/http_auth_unittest.cc b/net/http/http_auth_unittest.cc index cc616a0..10ce05d 100644 --- a/net/http/http_auth_unittest.cc +++ b/net/http/http_auth_unittest.cc @@ -90,6 +90,7 @@ TEST(HttpAuthTest, ChooseBestChallenge) { headers.get(), HttpAuth::AUTH_SERVER, origin, + BoundNetLog(), &handler); if (handler) { @@ -147,6 +148,7 @@ TEST(HttpAuthTest, ChooseBestChallengeConnectionBased) { headers.get(), HttpAuth::AUTH_SERVER, origin, + BoundNetLog(), &handler); EXPECT_TRUE(handler != NULL); diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index d8beb78..8a4f486 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -1361,7 +1361,7 @@ int HttpNetworkTransaction::DoResolveCanonicalName() { DCHECK(auth_handler); next_state_ = STATE_RESOLVE_CANONICAL_NAME_COMPLETE; return auth_handler->ResolveCanonicalName(session_->host_resolver(), - &io_callback_, net_log_); + &io_callback_); } int HttpNetworkTransaction::DoResolveCanonicalNameComplete(int result) { @@ -1991,7 +1991,7 @@ bool HttpNetworkTransaction::SelectPreemptiveAuth(HttpAuth::Target target) { int rv_create = session_->http_auth_handler_factory()-> CreatePreemptiveAuthHandlerFromString( entry->auth_challenge(), target, AuthOrigin(target), - entry->IncrementNonceCount(), &handler_preemptive); + entry->IncrementNonceCount(), net_log_, &handler_preemptive); if (rv_create != OK) return false; @@ -2120,8 +2120,8 @@ int HttpNetworkTransaction::HandleAuthChallenge(bool establishing_tunnel) { !(request_->load_flags & LOAD_DO_NOT_SEND_AUTH_DATA)) { // Find the best authentication challenge that we support. HttpAuth::ChooseBestChallenge(session_->http_auth_handler_factory(), - headers, target, - auth_origin, &auth_handler_[target]); + headers, target, auth_origin, net_log_, + &auth_handler_[target]); } if (!auth_handler_[target]) { diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index b427814..79d176f 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -5428,8 +5428,7 @@ class MockAuthHandlerCanonical : public HttpAuthHandler { } virtual int ResolveCanonicalName(HostResolver* host_resolver, - CompletionCallback* callback, - const BoundNetLog& net_log) { + CompletionCallback* callback) { EXPECT_NE(RESOLVE_TESTED, resolve_); int rv = OK; switch (resolve_) { @@ -5503,6 +5502,7 @@ class MockAuthHandlerCanonical : public HttpAuthHandler { const GURL& origin, CreateReason reason, int nonce_count, + const BoundNetLog& net_log, scoped_refptr<HttpAuthHandler>* handler) { *handler = mock_handler_; return OK; diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc index 7c1369c..e9fe842 100644 --- a/net/socket_stream/socket_stream.cc +++ b/net/socket_stream/socket_stream.cc @@ -551,7 +551,7 @@ int SocketStream::DoWriteTunnelHeaders() { CreatePreemptiveAuthHandlerFromString( entry->auth_challenge(), HttpAuth::AUTH_PROXY, ProxyAuthOrigin(), entry->IncrementNonceCount(), - &handler_preemptive); + net_log_, &handler_preemptive); if (rv_create == OK) { auth_identity_.source = HttpAuth::IDENT_SRC_PATH_LOOKUP; auth_identity_.invalid = false; @@ -891,7 +891,7 @@ int SocketStream::HandleAuthChallenge(const HttpResponseHeaders* headers) { auth_identity_.invalid = true; HttpAuth::ChooseBestChallenge(http_auth_handler_factory_, headers, HttpAuth::AUTH_PROXY, - auth_origin, &auth_handler_); + auth_origin, net_log_, &auth_handler_); if (!auth_handler_) { LOG(ERROR) << "Can't perform auth to the proxy " << auth_origin; return ERR_TUNNEL_CONNECTION_FAILED; |