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

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

Issue 2100213002: Make QuicSpdyStream::ParseHeaderStatusCode() inparam const. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/quic/quic_spdy_stream_test.cc ('k') | net/tools/quic/quic_spdy_client_stream.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_simple_server_stream.h" 5 #include "net/tools/quic/quic_simple_server_stream.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (response->response_type() == QuicInMemoryCache::IGNORE_REQUEST) { 161 if (response->response_type() == QuicInMemoryCache::IGNORE_REQUEST) {
162 DVLOG(1) << "Special response: ignoring request."; 162 DVLOG(1) << "Special response: ignoring request.";
163 return; 163 return;
164 } 164 }
165 165
166 // Examing response status, if it was not pure integer as typical h2 response 166 // Examing response status, if it was not pure integer as typical h2 response
167 // status, send error response. 167 // status, send error response.
168 string request_url = request_headers_[":authority"].as_string() + 168 string request_url = request_headers_[":authority"].as_string() +
169 request_headers_[":path"].as_string(); 169 request_headers_[":path"].as_string();
170 int response_code; 170 int response_code;
171 SpdyHeaderBlock response_headers = response->headers(); 171 const SpdyHeaderBlock& response_headers = response->headers();
172 if (!ParseHeaderStatusCode(&response_headers, &response_code)) { 172 if (!ParseHeaderStatusCode(response_headers, &response_code)) {
173 DVLOG(1) << "Illegal (non-integer) response :status from cache: " 173 LOG(WARNING) << "Illegal (non-integer) response :status from cache: "
174 << response_headers[":status"].as_string() << " for request " 174 << response_headers.GetHeader(":status") << " for request "
175 << request_url; 175 << request_url;
176 SendErrorResponse(); 176 SendErrorResponse();
177 return; 177 return;
178 } 178 }
179 179
180 if (id() % 2 == 0) { 180 if (id() % 2 == 0) {
181 // A server initiated stream is only used for a server push response, 181 // A server initiated stream is only used for a server push response,
182 // and only 200 and 30X response codes are supported for server push. 182 // and only 200 and 30X response codes are supported for server push.
183 // This behavior mirrors the HTTP/2 implementation. 183 // This behavior mirrors the HTTP/2 implementation.
184 bool is_redirection = response_code / 100 == 3; 184 bool is_redirection = response_code / 100 == 3;
185 if (response_code != 200 && !is_redirection) { 185 if (response_code != 200 && !is_redirection) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 DVLOG(1) << "Writing trailers (fin = true): " 262 DVLOG(1) << "Writing trailers (fin = true): "
263 << response_trailers.DebugString(); 263 << response_trailers.DebugString();
264 WriteTrailers(response_trailers, nullptr); 264 WriteTrailers(response_trailers, nullptr);
265 } 265 }
266 266
267 const char* const QuicSimpleServerStream::kErrorResponseBody = "bad"; 267 const char* const QuicSimpleServerStream::kErrorResponseBody = "bad";
268 const char* const QuicSimpleServerStream::kNotFoundResponseBody = 268 const char* const QuicSimpleServerStream::kNotFoundResponseBody =
269 "file not found"; 269 "file not found";
270 270
271 } // namespace net 271 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_spdy_stream_test.cc ('k') | net/tools/quic/quic_spdy_client_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698