| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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_cache.h" | 5 #include "net/http/http_auth_cache.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // Debug helper to check that |path| arguments are properly formed. | 28 // Debug helper to check that |path| arguments are properly formed. |
| 29 // (should be absolute path, or empty string). | 29 // (should be absolute path, or empty string). |
| 30 void CheckPathIsValid(const std::string& path) { | 30 void CheckPathIsValid(const std::string& path) { |
| 31 DCHECK(path.empty() || path[0] == '/'); | 31 DCHECK(path.empty() || path[0] == '/'); |
| 32 } | 32 } |
| 33 | 33 |
| 34 // Return true if |path| is a subpath of |container|. In other words, is | 34 // Return true if |path| is a subpath of |container|. In other words, is |
| 35 // |container| an ancestor of |path|? | 35 // |container| an ancestor of |path|? |
| 36 bool IsEnclosingPath(const std::string& container, const std::string& path) { | 36 bool IsEnclosingPath(const std::string& container, const std::string& path) { |
| 37 DCHECK(container.empty() || *(container.end() - 1) == '/'); | 37 DCHECK(container.empty() || *(container.end() - 1) == '/'); |
| 38 return (container.empty() && path.empty()) || | 38 return ((container.empty() && path.empty()) || |
| 39 (!container.empty() && StartsWithASCII(path, container, true)); | 39 (!container.empty() && StartsWithASCII(path, container, true))); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Debug helper to check that |origin| arguments are properly formed. | 42 // Debug helper to check that |origin| arguments are properly formed. |
| 43 void CheckOriginIsValid(const GURL& origin) { | 43 void CheckOriginIsValid(const GURL& origin) { |
| 44 DCHECK(origin.is_valid()); | 44 DCHECK(origin.is_valid()); |
| 45 DCHECK(origin.SchemeIs("http") || origin.SchemeIs("https")); | 45 DCHECK(origin.SchemeIs("http") || origin.SchemeIs("https")); |
| 46 DCHECK(origin.GetOrigin() == origin); | 46 DCHECK(origin.GetOrigin() == origin); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // Functor used by remove_if. | 49 // Functor used by remove_if. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 entries_.erase(it); | 163 entries_.erase(it); |
| 164 return true; | 164 return true; |
| 165 } | 165 } |
| 166 return false; | 166 return false; |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 return false; | 169 return false; |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace net | 172 } // namespace net |
| OLD | NEW |