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

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

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 years, 8 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.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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 string raw_headers = 114 string raw_headers =
115 HttpUtil::AssembleRawHeaders(file_contents.data(), headers_end); 115 HttpUtil::AssembleRawHeaders(file_contents.data(), headers_end);
116 116
117 scoped_refptr<HttpResponseHeaders> response_headers = 117 scoped_refptr<HttpResponseHeaders> response_headers =
118 new HttpResponseHeaders(raw_headers); 118 new HttpResponseHeaders(raw_headers);
119 119
120 string base; 120 string base;
121 if (response_headers->GetNormalizedHeader("X-Original-Url", &base)) { 121 if (response_headers->GetNormalizedHeader("X-Original-Url", &base)) {
122 response_headers->RemoveHeader("X-Original-Url"); 122 response_headers->RemoveHeader("X-Original-Url");
123 // Remove the protocol so we can add it below. 123 // Remove the protocol so we can add it below.
124 if (StartsWithASCII(base, "https://", false)) { 124 if (base::StartsWithASCII(base, "https://", false)) {
125 base = base.substr(8); 125 base = base.substr(8);
126 } else if (StartsWithASCII(base, "http://", false)) { 126 } else if (base::StartsWithASCII(base, "http://", false)) {
127 base = base.substr(7); 127 base = base.substr(7);
128 } 128 }
129 } else { 129 } else {
130 base = file; 130 base = file;
131 } 131 }
132 132
133 size_t path_start = base.find_first_of('/'); 133 size_t path_start = base.find_first_of('/');
134 StringPiece host(StringPiece(base).substr(0, path_start)); 134 StringPiece host(StringPiece(base).substr(0, path_start));
135 StringPiece path(StringPiece(base).substr(path_start)); 135 StringPiece path(StringPiece(base).substr(path_start));
136 if (path[path.length() - 1] == ',') { 136 if (path[path.length() - 1] == ',') {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 new_response->set_body(response_body); 172 new_response->set_body(response_body);
173 responses_[key] = new_response; 173 responses_[key] = new_response;
174 } 174 }
175 175
176 string QuicInMemoryCache::GetKey(StringPiece host, StringPiece path) const { 176 string QuicInMemoryCache::GetKey(StringPiece host, StringPiece path) const {
177 return host.as_string() + path.as_string(); 177 return host.as_string() + path.as_string();
178 } 178 }
179 179
180 } // namespace tools 180 } // namespace tools
181 } // namespace net 181 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client_bin.cc ('k') | net/tools/quic/quic_simple_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698