Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: net/tools/quic/quic_in_memory_cache.cc

Issue 1215933004: New new versions of Starts/EndsWith and SplitString in net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/tools/quic/quic_client_bin.cc ('k') | net/tools/quic/quic_simple_client_bin.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/files/file_enumerator.h" 7 #include "base/files/file_enumerator.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 string raw_headers = 121 string raw_headers =
122 HttpUtil::AssembleRawHeaders(file_contents.data(), headers_end); 122 HttpUtil::AssembleRawHeaders(file_contents.data(), headers_end);
123 123
124 scoped_refptr<HttpResponseHeaders> response_headers = 124 scoped_refptr<HttpResponseHeaders> response_headers =
125 new HttpResponseHeaders(raw_headers); 125 new HttpResponseHeaders(raw_headers);
126 126
127 string base; 127 string base;
128 if (response_headers->GetNormalizedHeader("X-Original-Url", &base)) { 128 if (response_headers->GetNormalizedHeader("X-Original-Url", &base)) {
129 response_headers->RemoveHeader("X-Original-Url"); 129 response_headers->RemoveHeader("X-Original-Url");
130 // Remove the protocol so we can add it below. 130 // Remove the protocol so we can add it below.
131 if (base::StartsWithASCII(base, "https://", false)) { 131 if (base::StartsWith(base, "https://",
132 base::CompareCase::INSENSITIVE_ASCII)) {
132 base = base.substr(8); 133 base = base.substr(8);
133 } else if (base::StartsWithASCII(base, "http://", false)) { 134 } else if (base::StartsWith(base, "http://",
135 base::CompareCase::INSENSITIVE_ASCII)) {
134 base = base.substr(7); 136 base = base.substr(7);
135 } 137 }
136 } else { 138 } else {
137 base = file; 139 base = file;
138 } 140 }
139 141
140 size_t path_start = base.find_first_of('/'); 142 size_t path_start = base.find_first_of('/');
141 StringPiece host(StringPiece(base).substr(0, path_start)); 143 StringPiece host(StringPiece(base).substr(0, path_start));
142 StringPiece path(StringPiece(base).substr(path_start)); 144 StringPiece path(StringPiece(base).substr(path_start));
143 if (path[path.length() - 1] == ',') { 145 if (path[path.length() - 1] == ',') {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 new_response->set_body(response_body); 181 new_response->set_body(response_body);
180 responses_[key] = new_response; 182 responses_[key] = new_response;
181 } 183 }
182 184
183 string QuicInMemoryCache::GetKey(StringPiece host, StringPiece path) const { 185 string QuicInMemoryCache::GetKey(StringPiece host, StringPiece path) const {
184 return host.as_string() + path.as_string(); 186 return host.as_string() + path.as_string();
185 } 187 }
186 188
187 } // namespace tools 189 } // namespace tools
188 } // namespace net 190 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client_bin.cc ('k') | net/tools/quic/quic_simple_client_bin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698