OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 // (should be absolute path, or empty string). | 30 // (should be absolute path, or empty string). |
31 void CheckPathIsValid(const std::string& path) { | 31 void CheckPathIsValid(const std::string& path) { |
32 DCHECK(path.empty() || path[0] == '/'); | 32 DCHECK(path.empty() || path[0] == '/'); |
33 } | 33 } |
34 | 34 |
35 // Return true if |path| is a subpath of |container|. In other words, is | 35 // Return true if |path| is a subpath of |container|. In other words, is |
36 // |container| an ancestor of |path|? | 36 // |container| an ancestor of |path|? |
37 bool IsEnclosingPath(const std::string& container, const std::string& path) { | 37 bool IsEnclosingPath(const std::string& container, const std::string& path) { |
38 DCHECK(container.empty() || *(container.end() - 1) == '/'); | 38 DCHECK(container.empty() || *(container.end() - 1) == '/'); |
39 return ((container.empty() && path.empty()) || | 39 return ((container.empty() && path.empty()) || |
40 (!container.empty() && base::StartsWithASCII(path, container, true))); | 40 (!container.empty() && |
| 41 base::StartsWith(path, container, base::CompareCase::SENSITIVE))); |
41 } | 42 } |
42 | 43 |
43 // Debug helper to check that |origin| arguments are properly formed. | 44 // Debug helper to check that |origin| arguments are properly formed. |
44 void CheckOriginIsValid(const GURL& origin) { | 45 void CheckOriginIsValid(const GURL& origin) { |
45 DCHECK(origin.is_valid()); | 46 DCHECK(origin.is_valid()); |
46 // Note that the scheme may be FTP when we're using a HTTP proxy. | 47 // Note that the scheme may be FTP when we're using a HTTP proxy. |
47 DCHECK(origin.SchemeIsHTTPOrHTTPS() || origin.SchemeIs("ftp") || | 48 DCHECK(origin.SchemeIsHTTPOrHTTPS() || origin.SchemeIs("ftp") || |
48 origin.SchemeIsWSOrWSS()); | 49 origin.SchemeIsWSOrWSS()); |
49 DCHECK(origin.GetOrigin() == origin); | 50 DCHECK(origin.GetOrigin() == origin); |
50 } | 51 } |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 // Copy all other paths. | 277 // Copy all other paths. |
277 for (Entry::PathList::const_reverse_iterator it2 = ++it->paths_.rbegin(); | 278 for (Entry::PathList::const_reverse_iterator it2 = ++it->paths_.rbegin(); |
278 it2 != it->paths_.rend(); ++it2) | 279 it2 != it->paths_.rend(); ++it2) |
279 entry->AddPath(*it2); | 280 entry->AddPath(*it2); |
280 // Copy nonce count (for digest authentication). | 281 // Copy nonce count (for digest authentication). |
281 entry->nonce_count_ = it->nonce_count_; | 282 entry->nonce_count_ = it->nonce_count_; |
282 } | 283 } |
283 } | 284 } |
284 | 285 |
285 } // namespace net | 286 } // namespace net |
OLD | NEW |