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

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: Move browser/spdyproxy to browser/net/spdyproxy. Created 8 years, 3 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 &system_enable_referrers_, 434 &system_enable_referrers_,
434 NULL); 435 NULL);
435 if (command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) 436 if (command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling))
436 network_delegate->NeverThrottleRequests(); 437 network_delegate->NeverThrottleRequests();
437 globals_->system_network_delegate.reset(network_delegate); 438 globals_->system_network_delegate.reset(network_delegate);
438 globals_->host_resolver.reset( 439 globals_->host_resolver.reset(
439 CreateGlobalHostResolver(net_log_)); 440 CreateGlobalHostResolver(net_log_));
440 globals_->cert_verifier.reset(net::CertVerifier::CreateDefault()); 441 globals_->cert_verifier.reset(net::CertVerifier::CreateDefault());
441 globals_->transport_security_state.reset(new net::TransportSecurityState()); 442 globals_->transport_security_state.reset(new net::TransportSecurityState());
442 globals_->ssl_config_service = GetSSLConfigService(); 443 globals_->ssl_config_service = GetSSLConfigService();
444 if (command_line.HasSwitch(switches::kSpdyProxyOrigin)) {
445 spdyproxy_origin_ =
446 command_line.GetSwitchValueASCII(switches::kSpdyProxyOrigin);
447 }
443 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( 448 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory(
444 globals_->host_resolver.get())); 449 globals_->host_resolver.get()));
445 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl); 450 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl);
446 // For the ProxyScriptFetcher, we use a direct ProxyService. 451 // For the ProxyScriptFetcher, we use a direct ProxyService.
447 globals_->proxy_script_fetcher_proxy_service.reset( 452 globals_->proxy_script_fetcher_proxy_service.reset(
448 net::ProxyService::CreateDirectWithNetLog(net_log_)); 453 net::ProxyService::CreateDirectWithNetLog(net_log_));
449 // In-memory cookie store. 454 // In-memory cookie store.
450 globals_->system_cookie_store = new net::CookieMonster(NULL, NULL); 455 globals_->system_cookie_store = new net::CookieMonster(NULL, NULL);
451 // In-memory server bound cert store. 456 // In-memory server bound cert store.
452 globals_->system_server_bound_cert_service.reset( 457 globals_->system_server_bound_cert_service.reset(
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 571
567 delete globals_; 572 delete globals_;
568 globals_ = NULL; 573 globals_ = NULL;
569 574
570 base::debug::LeakTracker<SystemURLRequestContextGetter>::CheckForLeaks(); 575 base::debug::LeakTracker<SystemURLRequestContextGetter>::CheckForLeaks();
571 } 576 }
572 577
573 // static 578 // static
574 void IOThread::RegisterPrefs(PrefService* local_state) { 579 void IOThread::RegisterPrefs(PrefService* local_state) {
575 local_state->RegisterStringPref(prefs::kAuthSchemes, 580 local_state->RegisterStringPref(prefs::kAuthSchemes,
576 "basic,digest,ntlm,negotiate"); 581 "basic,digest,ntlm,negotiate,"
582 "spdyproxy");
577 local_state->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, 583 local_state->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup,
578 false); 584 false);
579 local_state->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); 585 local_state->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false);
580 local_state->RegisterStringPref(prefs::kAuthServerWhitelist, ""); 586 local_state->RegisterStringPref(prefs::kAuthServerWhitelist, "");
581 local_state->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, ""); 587 local_state->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, "");
582 local_state->RegisterStringPref(prefs::kGSSAPILibraryName, ""); 588 local_state->RegisterStringPref(prefs::kGSSAPILibraryName, "");
589 local_state->RegisterStringPref(prefs::kSpdyProxyOrigin, "");
583 local_state->RegisterBooleanPref(prefs::kEnableReferrers, true); 590 local_state->RegisterBooleanPref(prefs::kEnableReferrers, true);
584 } 591 }
585 592
586 net::HttpAuthHandlerFactory* IOThread::CreateDefaultAuthHandlerFactory( 593 net::HttpAuthHandlerFactory* IOThread::CreateDefaultAuthHandlerFactory(
587 net::HostResolver* resolver) { 594 net::HostResolver* resolver) {
588 net::HttpAuthFilterWhitelist* auth_filter_default_credentials = NULL; 595 net::HttpAuthFilterWhitelist* auth_filter_default_credentials = NULL;
589 if (!auth_server_whitelist_.empty()) { 596 if (!auth_server_whitelist_.empty()) {
590 auth_filter_default_credentials = 597 auth_filter_default_credentials =
591 new net::HttpAuthFilterWhitelist(auth_server_whitelist_); 598 new net::HttpAuthFilterWhitelist(auth_server_whitelist_);
592 } 599 }
593 net::HttpAuthFilterWhitelist* auth_filter_delegate = NULL; 600 net::HttpAuthFilterWhitelist* auth_filter_delegate = NULL;
594 if (!auth_delegate_whitelist_.empty()) { 601 if (!auth_delegate_whitelist_.empty()) {
595 auth_filter_delegate = 602 auth_filter_delegate =
596 new net::HttpAuthFilterWhitelist(auth_delegate_whitelist_); 603 new net::HttpAuthFilterWhitelist(auth_delegate_whitelist_);
597 } 604 }
598 globals_->url_security_manager.reset( 605 globals_->url_security_manager.reset(
599 net::URLSecurityManager::Create(auth_filter_default_credentials, 606 net::URLSecurityManager::Create(auth_filter_default_credentials,
600 auth_filter_delegate)); 607 auth_filter_delegate));
601 std::vector<std::string> supported_schemes; 608 std::vector<std::string> supported_schemes;
602 base::SplitString(auth_schemes_, ',', &supported_schemes); 609 base::SplitString(auth_schemes_, ',', &supported_schemes);
603 610
604 return net::HttpAuthHandlerRegistryFactory::Create( 611 scoped_ptr<net::HttpAuthHandlerRegistryFactory> registry_factory(
605 supported_schemes, 612 net::HttpAuthHandlerRegistryFactory::Create(
606 globals_->url_security_manager.get(), 613 supported_schemes, globals_->url_security_manager.get(),
607 resolver, 614 resolver, gssapi_library_name_, negotiate_disable_cname_lookup_,
608 gssapi_library_name_, 615 negotiate_enable_port_));
609 negotiate_disable_cname_lookup_, 616
610 negotiate_enable_port_); 617 if (!spdyproxy_origin_.empty()) {
618 GURL origin_url(spdyproxy_origin_);
619 if (origin_url.is_valid()) {
620 registry_factory->RegisterSchemeFactory(
621 "spdyproxy",
622 new spdyproxy::HttpAuthHandlerSpdyProxy::Factory(origin_url));
623 } else {
624 LOG(WARNING) << "Skipping creation of SpdyProxy auth handler since "
625 << "authorized origin is invalid: "
626 << spdyproxy_origin_;
627 }
628 }
629
630 return registry_factory.release();
611 } 631 }
612 632
613 void IOThread::ClearHostCache() { 633 void IOThread::ClearHostCache() {
614 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 634 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
615 635
616 net::HostCache* host_cache = globals_->host_resolver->GetHostCache(); 636 net::HostCache* host_cache = globals_->host_resolver->GetHostCache();
617 if (host_cache) 637 if (host_cache)
618 host_cache->clear(); 638 host_cache->clear();
619 } 639 }
620 640
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 new net::HttpNetworkLayer( 712 new net::HttpNetworkLayer(
693 new net::HttpNetworkSession(system_params))); 713 new net::HttpNetworkSession(system_params)));
694 globals_->system_ftp_transaction_factory.reset( 714 globals_->system_ftp_transaction_factory.reset(
695 new net::FtpNetworkLayer(globals_->host_resolver.get())); 715 new net::FtpNetworkLayer(globals_->host_resolver.get()));
696 globals_->system_request_context.reset( 716 globals_->system_request_context.reset(
697 ConstructSystemRequestContext(globals_, net_log_)); 717 ConstructSystemRequestContext(globals_, net_log_));
698 718
699 sdch_manager_->set_sdch_fetcher( 719 sdch_manager_->set_sdch_fetcher(
700 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); 720 new SdchDictionaryFetcher(system_url_request_context_getter_.get()));
701 } 721 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698