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

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

Issue 1819853003: QUIC - extend QuicInMemoryCache so that simple server can do server push. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix asan detected bug Created 4 years, 9 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_in_memory_cache_test.cc ('k') | no next file » | 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_simple_server_stream.h" 5 #include "net/tools/quic/quic_simple_server_stream.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 return; 135 return;
136 } 136 }
137 137
138 if (response->response_type() == QuicInMemoryCache::IGNORE_REQUEST) { 138 if (response->response_type() == QuicInMemoryCache::IGNORE_REQUEST) {
139 DVLOG(1) << "Special response: ignoring request."; 139 DVLOG(1) << "Special response: ignoring request.";
140 return; 140 return;
141 } 141 }
142 142
143 // Examing response status, if it was not pure integer as typical h2 response 143 // Examing response status, if it was not pure integer as typical h2 response
144 // status, send error response. 144 // status, send error response.
145 string request_url; 145 string request_url = request_headers_[":authority"].as_string() +
146 if (!request_headers_[":scheme"].as_string().empty()) { 146 request_headers_[":path"].as_string();
147 request_url = request_headers_[":scheme"].as_string() + "://" +
148 request_headers_[":authority"].as_string() +
149 request_headers_[":path"].as_string();
150 } else {
151 request_url = request_headers_[":authority"].as_string() +
152 request_headers_[":path"].as_string();
153 }
154 int response_code; 147 int response_code;
155 SpdyHeaderBlock response_headers = response->headers(); 148 SpdyHeaderBlock response_headers = response->headers();
156 if (!base::StringToInt(response_headers[":status"], &response_code)) { 149 if (!base::StringToInt(response_headers[":status"], &response_code)) {
157 DVLOG(1) << "Illegal (non-integer) response :status from cache: " 150 DVLOG(1) << "Illegal (non-integer) response :status from cache: "
158 << response_headers[":status"].as_string() << " for request " 151 << response_headers[":status"].as_string() << " for request "
159 << request_url; 152 << request_url;
160 SendErrorResponse(); 153 SendErrorResponse();
161 return; 154 return;
162 } 155 }
163 156
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 DVLOG(1) << "Writing trailers (fin = true): " 239 DVLOG(1) << "Writing trailers (fin = true): "
247 << response_trailers.DebugString(); 240 << response_trailers.DebugString();
248 WriteTrailers(response_trailers, nullptr); 241 WriteTrailers(response_trailers, nullptr);
249 } 242 }
250 243
251 const char* const QuicSimpleServerStream::kErrorResponseBody = "bad"; 244 const char* const QuicSimpleServerStream::kErrorResponseBody = "bad";
252 const char* const QuicSimpleServerStream::kNotFoundResponseBody = 245 const char* const QuicSimpleServerStream::kNotFoundResponseBody =
253 "file not found"; 246 "file not found";
254 247
255 } // namespace net 248 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_in_memory_cache_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698