| 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/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "net/quic/quic_session.h" | 8 #include "net/quic/quic_session.h" |
| 9 #include "net/spdy/spdy_framer.h" | 9 #include "net/spdy/spdy_framer.h" |
| 10 #include "net/tools/quic/quic_in_memory_cache.h" | 10 #include "net/tools/quic/quic_in_memory_cache.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 if (request_headers_.empty()) { | 35 if (request_headers_.empty()) { |
| 36 if (!ParseRequestHeaders(data, data_len)) { | 36 if (!ParseRequestHeaders(data, data_len)) { |
| 37 // Headers were invalid. | 37 // Headers were invalid. |
| 38 SendErrorResponse(); | 38 SendErrorResponse(); |
| 39 return 0; | 39 return 0; |
| 40 } | 40 } |
| 41 } else { | 41 } else { |
| 42 body_.append(data, data_len); | 42 body_.append(data, data_len); |
| 43 } | 43 } |
| 44 DCHECK(!request_headers_.empty()); | 44 DCHECK(!request_headers_.empty()); |
| 45 if (content_length_ > 0 && static_cast<int>(body_.size()) > content_length_) { | 45 if (content_length_ >= 0 && |
| 46 static_cast<int>(body_.size()) > content_length_) { |
| 46 SendErrorResponse(); | 47 SendErrorResponse(); |
| 47 return 0; | 48 return 0; |
| 48 } | 49 } |
| 49 DVLOG(1) << "Processed " << data_len << " bytes for stream " << id(); | 50 DVLOG(1) << "Processed " << data_len << " bytes for stream " << id(); |
| 50 return data_len; | 51 return data_len; |
| 51 } | 52 } |
| 52 | 53 |
| 53 void QuicSpdyServerStream::OnFinRead() { | 54 void QuicSpdyServerStream::OnFinRead() { |
| 54 ReliableQuicStream::OnFinRead(); | 55 ReliableQuicStream::OnFinRead(); |
| 55 if (write_side_closed() || fin_buffered()) { | 56 if (write_side_closed() || fin_buffered()) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 144 |
| 144 WriteHeaders(response_headers, body.empty(), nullptr); | 145 WriteHeaders(response_headers, body.empty(), nullptr); |
| 145 | 146 |
| 146 if (!body.empty()) { | 147 if (!body.empty()) { |
| 147 WriteOrBufferData(body, true, nullptr); | 148 WriteOrBufferData(body, true, nullptr); |
| 148 } | 149 } |
| 149 } | 150 } |
| 150 | 151 |
| 151 } // namespace tools | 152 } // namespace tools |
| 152 } // namespace net | 153 } // namespace net |
| OLD | NEW |