| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "net/http/http_auth_filter.h" | 5 #include "net/http/http_auth_filter.h" |
| 6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
| 7 #include "googleurl/src/gurl.h" | 7 #include "googleurl/src/gurl.h" |
| 8 | 8 |
| 9 namespace net { | 9 namespace net { |
| 10 | 10 |
| 11 // Using a std::set<> has the benefit of removing duplicates automatically. | 11 // Using a std::set<> has the benefit of removing duplicates automatically. |
| 12 typedef std::set<string16> RegistryWhitelist; | 12 typedef std::set<string16> RegistryWhitelist; |
| 13 | 13 |
| 14 // TODO(ahendrickson) -- Determine if we want separate whitelists for HTTP and | 14 // TODO(ahendrickson) -- Determine if we want separate whitelists for HTTP and |
| 15 // HTTPS, one for both, or only an HTTP one. My understanding is that the HTTPS | 15 // HTTPS, one for both, or only an HTTP one. My understanding is that the HTTPS |
| 16 // entries in the registry mean that you are only allowed to connect to the site | 16 // entries in the registry mean that you are only allowed to connect to the site |
| 17 // via HTTPS and still be considered 'safe'. | 17 // via HTTPS and still be considered 'safe'. |
| 18 | 18 |
| 19 HttpAuthFilterWhitelist::HttpAuthFilterWhitelist() { | 19 HttpAuthFilterWhitelist::HttpAuthFilterWhitelist( |
| 20 const std::string& server_whitelist) { |
| 21 SetWhitelist(server_whitelist); |
| 20 } | 22 } |
| 21 | 23 |
| 22 HttpAuthFilterWhitelist::~HttpAuthFilterWhitelist() { | 24 HttpAuthFilterWhitelist::~HttpAuthFilterWhitelist() { |
| 23 } | 25 } |
| 24 | 26 |
| 25 void HttpAuthFilterWhitelist::SetWhitelist( | 27 void HttpAuthFilterWhitelist::SetWhitelist( |
| 26 const std::string& server_whitelist) { | 28 const std::string& server_whitelist) { |
| 27 rules_.ParseFromString(server_whitelist); | 29 rules_.ParseFromString(server_whitelist); |
| 28 } | 30 } |
| 29 | 31 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 47 return true; | 49 return true; |
| 48 rules_.AddRuleFromString(filter); | 50 rules_.AddRuleFromString(filter); |
| 49 return true; | 51 return true; |
| 50 } | 52 } |
| 51 | 53 |
| 52 void HttpAuthFilterWhitelist::AddRuleToBypassLocal() { | 54 void HttpAuthFilterWhitelist::AddRuleToBypassLocal() { |
| 53 rules_.AddRuleToBypassLocal(); | 55 rules_.AddRuleToBypassLocal(); |
| 54 } | 56 } |
| 55 | 57 |
| 56 } // namespace net | 58 } // namespace net |
| OLD | NEW |