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/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 25 matching lines...) Expand all Loading... |
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 // Note that the scheme may be FTP when we're using a HTTP proxy. | 45 // Note that the scheme may be FTP when we're using a HTTP proxy. |
46 DCHECK(origin.SchemeIsHTTPOrHTTPS() || origin.SchemeIs("ftp")); | 46 DCHECK(origin.SchemeIsHTTPOrHTTPS() || origin.SchemeIs("ftp") || |
| 47 origin.SchemeIsWSOrWSS()); |
47 DCHECK(origin.GetOrigin() == origin); | 48 DCHECK(origin.GetOrigin() == origin); |
48 } | 49 } |
49 | 50 |
50 // Functor used by remove_if. | 51 // Functor used by remove_if. |
51 struct IsEnclosedBy { | 52 struct IsEnclosedBy { |
52 explicit IsEnclosedBy(const std::string& path) : path(path) { } | 53 explicit IsEnclosedBy(const std::string& path) : path(path) { } |
53 bool operator() (const std::string& x) const { | 54 bool operator() (const std::string& x) const { |
54 return IsEnclosingPath(path, x); | 55 return IsEnclosingPath(path, x); |
55 } | 56 } |
56 const std::string& path; | 57 const std::string& path; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // Copy all other paths. | 235 // Copy all other paths. |
235 for (Entry::PathList::const_reverse_iterator it2 = ++it->paths_.rbegin(); | 236 for (Entry::PathList::const_reverse_iterator it2 = ++it->paths_.rbegin(); |
236 it2 != it->paths_.rend(); ++it2) | 237 it2 != it->paths_.rend(); ++it2) |
237 entry->AddPath(*it2); | 238 entry->AddPath(*it2); |
238 // Copy nonce count (for digest authentication). | 239 // Copy nonce count (for digest authentication). |
239 entry->nonce_count_ = it->nonce_count_; | 240 entry->nonce_count_ = it->nonce_count_; |
240 } | 241 } |
241 } | 242 } |
242 | 243 |
243 } // namespace net | 244 } // namespace net |
OLD | NEW |