OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tools/quic/quic_in_memory_cache.h" | 5 #include "net/tools/quic/quic_in_memory_cache.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/files/file_enumerator.h" | 9 #include "base/files/file_enumerator.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 host_ = base.substr(0, path_start); | 112 host_ = base.substr(0, path_start); |
113 size_t query_start = base.find_first_of(','); | 113 size_t query_start = base.find_first_of(','); |
114 if (query_start > 0) { | 114 if (query_start > 0) { |
115 path_ = base.substr(path_start, query_start - 1); | 115 path_ = base.substr(path_start, query_start - 1); |
116 } else { | 116 } else { |
117 path_ = base.substr(path_start); | 117 path_ = base.substr(path_start); |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 StringPiece QuicInMemoryCache::ResourceFile::RemoveScheme(StringPiece url) { | 121 StringPiece QuicInMemoryCache::ResourceFile::RemoveScheme(StringPiece url) { |
122 if (url.starts_with("https://")) { | 122 if (base::StartsWith(url, "https://", base::CompareCase::INSENSITIVE_ASCII)) { |
123 url.remove_prefix(8); | 123 url.remove_prefix(8); |
124 } else if (url.starts_with("http://")) { | 124 } else if (base::StartsWith(url, "http://", |
| 125 base::CompareCase::INSENSITIVE_ASCII)) { |
125 url.remove_prefix(7); | 126 url.remove_prefix(7); |
126 } | 127 } |
127 return url; | 128 return url; |
128 } | 129 } |
129 | 130 |
130 void QuicInMemoryCache::ResourceFile::HandleXOriginalUrl() { | 131 void QuicInMemoryCache::ResourceFile::HandleXOriginalUrl() { |
131 StringPiece url(x_original_url_); | 132 StringPiece url(x_original_url_); |
132 // Remove the protocol so we can add it below. | 133 // Remove the protocol so we can add it below. |
133 url = RemoveScheme(url); | 134 url = RemoveScheme(url); |
134 SetHostPathFromBase(url); | 135 SetHostPathFromBase(url); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 for (auto it = resource_range.first; it != resource_range.second; ++it) { | 366 for (auto it = resource_range.first; it != resource_range.second; ++it) { |
366 ServerPushInfo push_resource = it->second; | 367 ServerPushInfo push_resource = it->second; |
367 if (push_resource.request_url.spec() == resource.request_url.spec()) { | 368 if (push_resource.request_url.spec() == resource.request_url.spec()) { |
368 return true; | 369 return true; |
369 } | 370 } |
370 } | 371 } |
371 return false; | 372 return false; |
372 } | 373 } |
373 | 374 |
374 } // namespace net | 375 } // namespace net |
OLD | NEW |