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 "base/strings/string_util.h" | 5 #include "base/strings/string_util.h" |
6 #include "net/http/http_auth_filter.h" | 6 #include "net/http/http_auth_filter.h" |
7 #include "url/gurl.h" | 7 #include "url/gurl.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 if (target == HttpAuth::AUTH_PROXY) | 33 if (target == HttpAuth::AUTH_PROXY) |
34 return true; | 34 return true; |
35 rules_.AddRuleFromString(filter); | 35 rules_.AddRuleFromString(filter); |
36 return true; | 36 return true; |
37 } | 37 } |
38 | 38 |
39 void HttpAuthFilterWhitelist::AddRuleToBypassLocal() { | 39 void HttpAuthFilterWhitelist::AddRuleToBypassLocal() { |
40 rules_.AddRuleToBypassLocal(); | 40 rules_.AddRuleToBypassLocal(); |
41 } | 41 } |
42 | 42 |
43 bool HttpAuthFilterWhitelist::IsValid(const GURL& url, | 43 bool HttpAuthFilterWhitelist::IsValid(const url::Origin& origin, |
44 HttpAuth::Target target) const { | 44 HttpAuth::Target target) const { |
45 if ((target != HttpAuth::AUTH_SERVER) && (target != HttpAuth::AUTH_PROXY)) | 45 if ((target != HttpAuth::AUTH_SERVER) && (target != HttpAuth::AUTH_PROXY)) |
46 return false; | 46 return false; |
47 // All proxies pass | 47 // All proxies pass |
48 if (target == HttpAuth::AUTH_PROXY) | 48 if (target == HttpAuth::AUTH_PROXY) |
49 return true; | 49 return true; |
50 return rules_.Matches(url); | 50 return rules_.Matches(GURL(origin.serialize())); |
51 } | 51 } |
52 | 52 |
53 void HttpAuthFilterWhitelist::SetWhitelist( | 53 void HttpAuthFilterWhitelist::SetWhitelist( |
54 const std::string& server_whitelist) { | 54 const std::string& server_whitelist) { |
55 rules_.ParseFromString(server_whitelist); | 55 rules_.ParseFromString(server_whitelist); |
56 } | 56 } |
57 | 57 |
58 } // namespace net | 58 } // namespace net |
OLD | NEW |