Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: chrome/browser/io_thread.cc

Issue 10913238: SPDY proxy authentication support. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: IWYU Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 13 matching lines...) Expand all
24 #include "chrome/browser/net/async_dns_field_trial.h" 24 #include "chrome/browser/net/async_dns_field_trial.h"
25 #include "chrome/browser/net/chrome_net_log.h" 25 #include "chrome/browser/net/chrome_net_log.h"
26 #include "chrome/browser/net/chrome_network_delegate.h" 26 #include "chrome/browser/net/chrome_network_delegate.h"
27 #include "chrome/browser/net/chrome_url_request_context.h" 27 #include "chrome/browser/net/chrome_url_request_context.h"
28 #include "chrome/browser/net/connect_interceptor.h" 28 #include "chrome/browser/net/connect_interceptor.h"
29 #include "chrome/browser/net/http_pipelining_compatibility_client.h" 29 #include "chrome/browser/net/http_pipelining_compatibility_client.h"
30 #include "chrome/browser/net/load_time_stats.h" 30 #include "chrome/browser/net/load_time_stats.h"
31 #include "chrome/browser/net/pref_proxy_config_tracker.h" 31 #include "chrome/browser/net/pref_proxy_config_tracker.h"
32 #include "chrome/browser/net/proxy_service_factory.h" 32 #include "chrome/browser/net/proxy_service_factory.h"
33 #include "chrome/browser/net/sdch_dictionary_fetcher.h" 33 #include "chrome/browser/net/sdch_dictionary_fetcher.h"
34 #include "chrome/browser/net/spdyproxy/http_auth_handler_spdyproxy.h"
34 #include "chrome/browser/prefs/pref_service.h" 35 #include "chrome/browser/prefs/pref_service.h"
35 #include "chrome/common/chrome_switches.h" 36 #include "chrome/common/chrome_switches.h"
36 #include "chrome/common/pref_names.h" 37 #include "chrome/common/pref_names.h"
37 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
38 #include "content/public/common/content_client.h" 39 #include "content/public/common/content_client.h"
39 #include "net/base/cert_verifier.h" 40 #include "net/base/cert_verifier.h"
40 #include "net/base/default_server_bound_cert_store.h" 41 #include "net/base/default_server_bound_cert_store.h"
41 #include "net/base/host_cache.h" 42 #include "net/base/host_cache.h"
42 #include "net/base/host_mapping_rules.h" 43 #include "net/base/host_mapping_rules.h"
43 #include "net/base/host_resolver.h" 44 #include "net/base/host_resolver.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 NULL, 437 NULL,
437 NULL); 438 NULL);
438 if (command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) 439 if (command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling))
439 network_delegate->NeverThrottleRequests(); 440 network_delegate->NeverThrottleRequests();
440 globals_->system_network_delegate.reset(network_delegate); 441 globals_->system_network_delegate.reset(network_delegate);
441 globals_->host_resolver.reset( 442 globals_->host_resolver.reset(
442 CreateGlobalHostResolver(net_log_)); 443 CreateGlobalHostResolver(net_log_));
443 globals_->cert_verifier.reset(net::CertVerifier::CreateDefault()); 444 globals_->cert_verifier.reset(net::CertVerifier::CreateDefault());
444 globals_->transport_security_state.reset(new net::TransportSecurityState()); 445 globals_->transport_security_state.reset(new net::TransportSecurityState());
445 globals_->ssl_config_service = GetSSLConfigService(); 446 globals_->ssl_config_service = GetSSLConfigService();
447 if (command_line.HasSwitch(switches::kSpdyProxyOrigin)) {
448 spdyproxy_origin_ =
449 command_line.GetSwitchValueASCII(switches::kSpdyProxyOrigin);
450 }
446 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( 451 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory(
447 globals_->host_resolver.get())); 452 globals_->host_resolver.get()));
448 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl); 453 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl);
449 // For the ProxyScriptFetcher, we use a direct ProxyService. 454 // For the ProxyScriptFetcher, we use a direct ProxyService.
450 globals_->proxy_script_fetcher_proxy_service.reset( 455 globals_->proxy_script_fetcher_proxy_service.reset(
451 net::ProxyService::CreateDirectWithNetLog(net_log_)); 456 net::ProxyService::CreateDirectWithNetLog(net_log_));
452 // In-memory cookie store. 457 // In-memory cookie store.
453 globals_->system_cookie_store = new net::CookieMonster(NULL, NULL); 458 globals_->system_cookie_store = new net::CookieMonster(NULL, NULL);
454 // In-memory server bound cert store. 459 // In-memory server bound cert store.
455 globals_->system_server_bound_cert_service.reset( 460 globals_->system_server_bound_cert_service.reset(
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 574
570 delete globals_; 575 delete globals_;
571 globals_ = NULL; 576 globals_ = NULL;
572 577
573 base::debug::LeakTracker<SystemURLRequestContextGetter>::CheckForLeaks(); 578 base::debug::LeakTracker<SystemURLRequestContextGetter>::CheckForLeaks();
574 } 579 }
575 580
576 // static 581 // static
577 void IOThread::RegisterPrefs(PrefService* local_state) { 582 void IOThread::RegisterPrefs(PrefService* local_state) {
578 local_state->RegisterStringPref(prefs::kAuthSchemes, 583 local_state->RegisterStringPref(prefs::kAuthSchemes,
579 "basic,digest,ntlm,negotiate"); 584 "basic,digest,ntlm,negotiate,"
585 "spdyproxy");
580 local_state->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, 586 local_state->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup,
581 false); 587 false);
582 local_state->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); 588 local_state->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false);
583 local_state->RegisterStringPref(prefs::kAuthServerWhitelist, ""); 589 local_state->RegisterStringPref(prefs::kAuthServerWhitelist, "");
584 local_state->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, ""); 590 local_state->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, "");
585 local_state->RegisterStringPref(prefs::kGSSAPILibraryName, ""); 591 local_state->RegisterStringPref(prefs::kGSSAPILibraryName, "");
592 local_state->RegisterStringPref(prefs::kSpdyProxyOrigin, "");
586 local_state->RegisterBooleanPref(prefs::kEnableReferrers, true); 593 local_state->RegisterBooleanPref(prefs::kEnableReferrers, true);
587 } 594 }
588 595
589 net::HttpAuthHandlerFactory* IOThread::CreateDefaultAuthHandlerFactory( 596 net::HttpAuthHandlerFactory* IOThread::CreateDefaultAuthHandlerFactory(
590 net::HostResolver* resolver) { 597 net::HostResolver* resolver) {
591 net::HttpAuthFilterWhitelist* auth_filter_default_credentials = NULL; 598 net::HttpAuthFilterWhitelist* auth_filter_default_credentials = NULL;
592 if (!auth_server_whitelist_.empty()) { 599 if (!auth_server_whitelist_.empty()) {
593 auth_filter_default_credentials = 600 auth_filter_default_credentials =
594 new net::HttpAuthFilterWhitelist(auth_server_whitelist_); 601 new net::HttpAuthFilterWhitelist(auth_server_whitelist_);
595 } 602 }
596 net::HttpAuthFilterWhitelist* auth_filter_delegate = NULL; 603 net::HttpAuthFilterWhitelist* auth_filter_delegate = NULL;
597 if (!auth_delegate_whitelist_.empty()) { 604 if (!auth_delegate_whitelist_.empty()) {
598 auth_filter_delegate = 605 auth_filter_delegate =
599 new net::HttpAuthFilterWhitelist(auth_delegate_whitelist_); 606 new net::HttpAuthFilterWhitelist(auth_delegate_whitelist_);
600 } 607 }
601 globals_->url_security_manager.reset( 608 globals_->url_security_manager.reset(
602 net::URLSecurityManager::Create(auth_filter_default_credentials, 609 net::URLSecurityManager::Create(auth_filter_default_credentials,
603 auth_filter_delegate)); 610 auth_filter_delegate));
604 std::vector<std::string> supported_schemes; 611 std::vector<std::string> supported_schemes;
605 base::SplitString(auth_schemes_, ',', &supported_schemes); 612 base::SplitString(auth_schemes_, ',', &supported_schemes);
606 613
607 return net::HttpAuthHandlerRegistryFactory::Create( 614 scoped_ptr<net::HttpAuthHandlerRegistryFactory> registry_factory(
608 supported_schemes, 615 net::HttpAuthHandlerRegistryFactory::Create(
609 globals_->url_security_manager.get(), 616 supported_schemes, globals_->url_security_manager.get(),
610 resolver, 617 resolver, gssapi_library_name_, negotiate_disable_cname_lookup_,
611 gssapi_library_name_, 618 negotiate_enable_port_));
612 negotiate_disable_cname_lookup_, 619
613 negotiate_enable_port_); 620 if (!spdyproxy_origin_.empty()) {
621 GURL origin_url(spdyproxy_origin_);
622 if (origin_url.is_valid()) {
623 registry_factory->RegisterSchemeFactory(
624 "spdyproxy",
625 new spdyproxy::HttpAuthHandlerSpdyProxy::Factory(origin_url));
626 } else {
627 LOG(WARNING) << "Skipping creation of SpdyProxy auth handler since "
628 << "authorized origin is invalid: "
629 << spdyproxy_origin_;
630 }
631 }
632
633 return registry_factory.release();
614 } 634 }
615 635
616 void IOThread::ClearHostCache() { 636 void IOThread::ClearHostCache() {
617 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 637 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
618 638
619 net::HostCache* host_cache = globals_->host_resolver->GetHostCache(); 639 net::HostCache* host_cache = globals_->host_resolver->GetHostCache();
620 if (host_cache) 640 if (host_cache)
621 host_cache->clear(); 641 host_cache->clear();
622 } 642 }
623 643
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 new net::HttpNetworkLayer( 715 new net::HttpNetworkLayer(
696 new net::HttpNetworkSession(system_params))); 716 new net::HttpNetworkSession(system_params)));
697 globals_->system_ftp_transaction_factory.reset( 717 globals_->system_ftp_transaction_factory.reset(
698 new net::FtpNetworkLayer(globals_->host_resolver.get())); 718 new net::FtpNetworkLayer(globals_->host_resolver.get()));
699 globals_->system_request_context.reset( 719 globals_->system_request_context.reset(
700 ConstructSystemRequestContext(globals_, net_log_)); 720 ConstructSystemRequestContext(globals_, net_log_));
701 721
702 sdch_manager_->set_sdch_fetcher( 722 sdch_manager_->set_sdch_fetcher(
703 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); 723 new SdchDictionaryFetcher(system_url_request_context_getter_.get()));
704 } 724 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698