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

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

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