| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 QuicInMemoryCache::GetInstance()->GetResponse( | 109 QuicInMemoryCache::GetInstance()->GetResponse( |
| 110 request_headers_[":authority"], request_headers_[":path"]); | 110 request_headers_[":authority"], request_headers_[":path"]); |
| 111 if (response == nullptr) { | 111 if (response == nullptr) { |
| 112 DVLOG(1) << "Response not found in cache."; | 112 DVLOG(1) << "Response not found in cache."; |
| 113 SendErrorResponse(); | 113 SendErrorResponse(); |
| 114 return; | 114 return; |
| 115 } | 115 } |
| 116 | 116 |
| 117 if (response->response_type() == QuicInMemoryCache::CLOSE_CONNECTION) { | 117 if (response->response_type() == QuicInMemoryCache::CLOSE_CONNECTION) { |
| 118 DVLOG(1) << "Special response: closing connection."; | 118 DVLOG(1) << "Special response: closing connection."; |
| 119 CloseConnection(QUIC_NO_ERROR); | 119 CloseConnectionWithDetails(QUIC_NO_ERROR, "Toy server forcing close"); |
| 120 return; | 120 return; |
| 121 } | 121 } |
| 122 | 122 |
| 123 if (response->response_type() == QuicInMemoryCache::IGNORE_REQUEST) { | 123 if (response->response_type() == QuicInMemoryCache::IGNORE_REQUEST) { |
| 124 DVLOG(1) << "Special response: ignoring request."; | 124 DVLOG(1) << "Special response: ignoring request."; |
| 125 return; | 125 return; |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Examing response status, if it was not pure integer as typical h2 response | 128 // Examing response status, if it was not pure integer as typical h2 response |
| 129 // status, send error response. | 129 // status, send error response. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // Send the trailers. A FIN is always sent with trailers. | 204 // Send the trailers. A FIN is always sent with trailers. |
| 205 DVLOG(1) << "Writing trailers (fin = true): " | 205 DVLOG(1) << "Writing trailers (fin = true): " |
| 206 << response_trailers.DebugString(); | 206 << response_trailers.DebugString(); |
| 207 WriteTrailers(response_trailers, nullptr); | 207 WriteTrailers(response_trailers, nullptr); |
| 208 } | 208 } |
| 209 | 209 |
| 210 const char* const QuicSimpleServerStream::kErrorResponseBody = "bad"; | 210 const char* const QuicSimpleServerStream::kErrorResponseBody = "bad"; |
| 211 | 211 |
| 212 } // namespace tools | 212 } // namespace tools |
| 213 } // namespace net | 213 } // namespace net |
| OLD | NEW |