summaryrefslogtreecommitdiffstats
path: root/chrome/browser/io_thread.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/io_thread.cc')
-rw-r--r--chrome/browser/io_thread.cc30
1 files changed, 28 insertions, 2 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index f4d4698..cda63ef 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -17,6 +17,7 @@
#include "net/base/host_resolver_impl.h"
#include "net/base/net_util.h"
#include "net/base/network_change_notifier.h"
+#include "net/http/http_auth_filter.h"
#include "net/http/http_auth_handler_factory.h"
#include "net/url_request/url_request.h"
@@ -127,8 +128,7 @@ void IOThread::Init() {
net::NetworkChangeNotifier::CreateDefaultNetworkChangeNotifier());
globals_->host_resolver =
CreateGlobalHostResolver(globals_->network_change_notifier.get());
- globals_->http_auth_handler_factory.reset(
- net::HttpAuthHandlerFactory::CreateDefault());
+ globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory());
}
void IOThread::CleanUp() {
@@ -176,6 +176,32 @@ void IOThread::CleanUp() {
BrowserProcessSubThread::CleanUp();
}
+net::HttpAuthHandlerFactory* IOThread::CreateDefaultAuthHandlerFactory() {
+ net::HttpAuthHandlerRegistryFactory* registry_factory =
+ net::HttpAuthHandlerFactory::CreateDefault();
+
+ // Get the whitelist information from the command line, create an
+ // HttpAuthFilterWhitelist, and attach it to the HttpAuthHandlerFactory.
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+
+ // Set the NTLM and Negotiate filters (from the same whitelist)
+ if (command_line.HasSwitch(switches::kAuthServerWhitelist)) {
+ std::string ntlm_server_whitelist =
+ command_line.GetSwitchValueASCII(switches::kAuthServerWhitelist);
+ net::HttpAuthFilterWhitelist* ntlm_whitelist =
+ new net::HttpAuthFilterWhitelist();
+ net::HttpAuthFilterWhitelist* negotiate_whitelist =
+ new net::HttpAuthFilterWhitelist();
+
+ ntlm_whitelist->SetFilters(ntlm_server_whitelist);
+ negotiate_whitelist->SetFilters(ntlm_server_whitelist);
+ registry_factory->SetFilter("ntlm", ntlm_whitelist);
+ registry_factory->SetFilter("negotiate", negotiate_whitelist);
+ }
+
+ return registry_factory;
+}
+
void IOThread::InitDnsMasterOnIOThread(
bool prefetching_enabled,
base::TimeDelta max_queue_delay,