| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |