| 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_spdy_server_stream.h" | 5 #include "net/tools/quic/quic_spdy_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" |
| 11 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
| 12 #include "net/quic/quic_data_stream.h" | |
| 13 #include "net/quic/quic_flags.h" | 12 #include "net/quic/quic_flags.h" |
| 14 #include "net/quic/quic_spdy_session.h" | 13 #include "net/quic/quic_spdy_session.h" |
| 14 #include "net/quic/quic_spdy_stream.h" |
| 15 #include "net/quic/spdy_utils.h" | 15 #include "net/quic/spdy_utils.h" |
| 16 #include "net/spdy/spdy_protocol.h" | 16 #include "net/spdy/spdy_protocol.h" |
| 17 #include "net/tools/quic/quic_in_memory_cache.h" | 17 #include "net/tools/quic/quic_in_memory_cache.h" |
| 18 | 18 |
| 19 using base::StringPiece; | 19 using base::StringPiece; |
| 20 using base::StringToInt; | 20 using base::StringToInt; |
| 21 using std::string; | 21 using std::string; |
| 22 | 22 |
| 23 namespace net { | 23 namespace net { |
| 24 namespace tools { | 24 namespace tools { |
| 25 | 25 |
| 26 QuicSpdyServerStream::QuicSpdyServerStream(QuicStreamId id, | 26 QuicSpdyServerStream::QuicSpdyServerStream(QuicStreamId id, |
| 27 QuicSpdySession* session) | 27 QuicSpdySession* session) |
| 28 : QuicDataStream(id, session), content_length_(-1) { | 28 : QuicSpdyStream(id, session), content_length_(-1) {} |
| 29 } | |
| 30 | 29 |
| 31 QuicSpdyServerStream::~QuicSpdyServerStream() { | 30 QuicSpdyServerStream::~QuicSpdyServerStream() { |
| 32 } | 31 } |
| 33 | 32 |
| 34 void QuicSpdyServerStream::OnStreamHeadersComplete(bool fin, size_t frame_len) { | 33 void QuicSpdyServerStream::OnStreamHeadersComplete(bool fin, size_t frame_len) { |
| 35 QuicDataStream::OnStreamHeadersComplete(fin, frame_len); | 34 QuicSpdyStream::OnStreamHeadersComplete(fin, frame_len); |
| 36 if (!ParseRequestHeaders(decompressed_headers().data(), | 35 if (!ParseRequestHeaders(decompressed_headers().data(), |
| 37 decompressed_headers().length())) { | 36 decompressed_headers().length())) { |
| 38 DVLOG(1) << "Invalid headers"; | 37 DVLOG(1) << "Invalid headers"; |
| 39 SendErrorResponse(); | 38 SendErrorResponse(); |
| 40 } | 39 } |
| 41 MarkHeadersConsumed(decompressed_headers().length()); | 40 MarkHeadersConsumed(decompressed_headers().length()); |
| 42 } | 41 } |
| 43 | 42 |
| 44 void QuicSpdyServerStream::OnDataAvailable() { | 43 void QuicSpdyServerStream::OnDataAvailable() { |
| 45 while (HasBytesToRead()) { | 44 while (HasBytesToRead()) { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 186 |
| 188 if (!body.empty()) { | 187 if (!body.empty()) { |
| 189 WriteOrBufferData(body, true, nullptr); | 188 WriteOrBufferData(body, true, nullptr); |
| 190 } | 189 } |
| 191 } | 190 } |
| 192 | 191 |
| 193 const char* const QuicSpdyServerStream::kErrorResponseBody = "bad"; | 192 const char* const QuicSpdyServerStream::kErrorResponseBody = "bad"; |
| 194 | 193 |
| 195 } // namespace tools | 194 } // namespace tools |
| 196 } // namespace net | 195 } // namespace net |
| OLD | NEW |