| 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 "net/quic/core/quic_spdy_stream.h" | 10 #include "net/quic/core/quic_spdy_stream.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 SpdyHeaderBlock response_headers, | 224 SpdyHeaderBlock response_headers, |
| 225 QuicStringPiece body) { | 225 QuicStringPiece body) { |
| 226 SendHeadersAndBodyAndTrailers(std::move(response_headers), body, | 226 SendHeadersAndBodyAndTrailers(std::move(response_headers), body, |
| 227 SpdyHeaderBlock()); | 227 SpdyHeaderBlock()); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void QuicSimpleServerStream::SendHeadersAndBodyAndTrailers( | 230 void QuicSimpleServerStream::SendHeadersAndBodyAndTrailers( |
| 231 SpdyHeaderBlock response_headers, | 231 SpdyHeaderBlock response_headers, |
| 232 QuicStringPiece body, | 232 QuicStringPiece body, |
| 233 SpdyHeaderBlock response_trailers) { | 233 SpdyHeaderBlock response_trailers) { |
| 234 if (!allow_bidirectional_data() && !reading_stopped()) { | |
| 235 StopReading(); | |
| 236 } | |
| 237 | |
| 238 // Send the headers, with a FIN if there's nothing else to send. | 234 // Send the headers, with a FIN if there's nothing else to send. |
| 239 bool send_fin = (body.empty() && response_trailers.empty()); | 235 bool send_fin = (body.empty() && response_trailers.empty()); |
| 240 QUIC_DLOG(INFO) << "Stream " << id() << " writing headers (fin = " << send_fin | 236 QUIC_DLOG(INFO) << "Stream " << id() << " writing headers (fin = " << send_fin |
| 241 << ") : " << response_headers.DebugString(); | 237 << ") : " << response_headers.DebugString(); |
| 242 WriteHeaders(std::move(response_headers), send_fin, nullptr); | 238 WriteHeaders(std::move(response_headers), send_fin, nullptr); |
| 243 if (send_fin) { | 239 if (send_fin) { |
| 244 // Nothing else to send. | 240 // Nothing else to send. |
| 245 return; | 241 return; |
| 246 } | 242 } |
| 247 | 243 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 261 QUIC_DLOG(INFO) << "Stream " << id() << " writing trailers (fin = true): " | 257 QUIC_DLOG(INFO) << "Stream " << id() << " writing trailers (fin = true): " |
| 262 << response_trailers.DebugString(); | 258 << response_trailers.DebugString(); |
| 263 WriteTrailers(std::move(response_trailers), nullptr); | 259 WriteTrailers(std::move(response_trailers), nullptr); |
| 264 } | 260 } |
| 265 | 261 |
| 266 const char* const QuicSimpleServerStream::kErrorResponseBody = "bad"; | 262 const char* const QuicSimpleServerStream::kErrorResponseBody = "bad"; |
| 267 const char* const QuicSimpleServerStream::kNotFoundResponseBody = | 263 const char* const QuicSimpleServerStream::kNotFoundResponseBody = |
| 268 "file not found"; | 264 "file not found"; |
| 269 | 265 |
| 270 } // namespace net | 266 } // namespace net |
| OLD | NEW |