| 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 "net/quic/quic_data_stream.h" | 10 #include "net/quic/quic_data_stream.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 DVLOG(1) << "Processed " << iov.iov_len << " bytes for stream " << id(); | 48 DVLOG(1) << "Processed " << iov.iov_len << " bytes for stream " << id(); |
| 49 body_.append(static_cast<char*>(iov.iov_base), iov.iov_len); | 49 body_.append(static_cast<char*>(iov.iov_base), iov.iov_len); |
| 50 | 50 |
| 51 if (content_length_ >= 0 && | 51 if (content_length_ >= 0 && |
| 52 static_cast<int>(body_.size()) > content_length_) { | 52 static_cast<int>(body_.size()) > content_length_) { |
| 53 SendErrorResponse(); | 53 SendErrorResponse(); |
| 54 return; | 54 return; |
| 55 } | 55 } |
| 56 MarkConsumed(iov.iov_len); | 56 MarkConsumed(iov.iov_len); |
| 57 } | 57 } |
| 58 if (sequencer()->IsClosed()) { | 58 if (!sequencer()->IsClosed()) { |
| 59 OnFinRead(); | |
| 60 } else { | |
| 61 sequencer()->SetUnblocked(); | 59 sequencer()->SetUnblocked(); |
| 60 return; |
| 62 } | 61 } |
| 63 } | |
| 64 | 62 |
| 65 void QuicSpdyServerStream::OnFinRead() { | 63 // If the sequencer is closed, then the all the body, including the fin, |
| 66 ReliableQuicStream::OnFinRead(); | 64 // has been consumed. |
| 65 OnFinRead(); |
| 66 |
| 67 if (write_side_closed() || fin_buffered()) { | 67 if (write_side_closed() || fin_buffered()) { |
| 68 return; | 68 return; |
| 69 } | 69 } |
| 70 | 70 |
| 71 if (request_headers_.empty()) { | 71 if (request_headers_.empty()) { |
| 72 SendErrorResponse(); | 72 SendErrorResponse(); |
| 73 return; | 73 return; |
| 74 } | 74 } |
| 75 | 75 |
| 76 if (content_length_ > 0 && | 76 if (content_length_ > 0 && |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 const string QuicSpdyServerStream::GetHostKey() { | 173 const string QuicSpdyServerStream::GetHostKey() { |
| 174 // SPDY/4 uses ":authority" instead of ":host". | 174 // SPDY/4 uses ":authority" instead of ":host". |
| 175 return version() > QUIC_VERSION_24 ? ":authority" : ":host"; | 175 return version() > QUIC_VERSION_24 ? ":authority" : ":host"; |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace tools | 178 } // namespace tools |
| 179 } // namespace net | 179 } // namespace net |
| OLD | NEW |