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 <list> | 7 #include <list> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 if (id() % 2 != 0) { | 93 if (id() % 2 != 0) { |
94 QUIC_BUG << "Client initiated stream shouldn't be used as promised stream."; | 94 QUIC_BUG << "Client initiated stream shouldn't be used as promised stream."; |
95 return; | 95 return; |
96 } | 96 } |
97 // Change the stream state to emulate a client request. | 97 // Change the stream state to emulate a client request. |
98 request_headers_ = std::move(push_request_headers); | 98 request_headers_ = std::move(push_request_headers); |
99 content_length_ = 0; | 99 content_length_ = 0; |
100 DVLOG(1) << "Stream " << id() << ": Ready to receive server push response."; | 100 DVLOG(1) << "Stream " << id() << ": Ready to receive server push response."; |
101 | 101 |
102 // Set as if stream decompresed the headers and received fin. | 102 // Set as if stream decompresed the headers and received fin. |
103 QuicSpdyStream::OnInitialHeadersComplete(/*fin=*/true, 0); | 103 QuicSpdyStream::OnInitialHeadersComplete(/*fin=*/true, 0, QuicHeaderList()); |
104 } | 104 } |
105 | 105 |
106 void QuicSimpleServerStream::SendResponse() { | 106 void QuicSimpleServerStream::SendResponse() { |
107 if (request_headers_.empty()) { | 107 if (request_headers_.empty()) { |
108 DVLOG(1) << "Request headers empty."; | 108 DVLOG(1) << "Request headers empty."; |
109 SendErrorResponse(); | 109 SendErrorResponse(); |
110 return; | 110 return; |
111 } | 111 } |
112 | 112 |
113 if (content_length_ > 0 && | 113 if (content_length_ > 0 && |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 DVLOG(1) << "Writing trailers (fin = true): " | 255 DVLOG(1) << "Writing trailers (fin = true): " |
256 << response_trailers.DebugString(); | 256 << response_trailers.DebugString(); |
257 WriteTrailers(std::move(response_trailers), nullptr); | 257 WriteTrailers(std::move(response_trailers), nullptr); |
258 } | 258 } |
259 | 259 |
260 const char* const QuicSimpleServerStream::kErrorResponseBody = "bad"; | 260 const char* const QuicSimpleServerStream::kErrorResponseBody = "bad"; |
261 const char* const QuicSimpleServerStream::kNotFoundResponseBody = | 261 const char* const QuicSimpleServerStream::kNotFoundResponseBody = |
262 "file not found"; | 262 "file not found"; |
263 | 263 |
264 } // namespace net | 264 } // namespace net |
OLD | NEW |