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/http/http_stream_parser.h" | 5 #include "net/http/http_stream_parser.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 int HttpStreamParser::ReadResponseBody(IOBuffer* buf, int buf_len, | 338 int HttpStreamParser::ReadResponseBody(IOBuffer* buf, int buf_len, |
339 const CompletionCallback& callback) { | 339 const CompletionCallback& callback) { |
340 DCHECK(io_state_ == STATE_NONE || io_state_ == STATE_DONE); | 340 DCHECK(io_state_ == STATE_NONE || io_state_ == STATE_DONE); |
341 DCHECK(callback_.is_null()); | 341 DCHECK(callback_.is_null()); |
342 DCHECK(!callback.is_null()); | 342 DCHECK(!callback.is_null()); |
343 DCHECK_LE(buf_len, kMaxBufSize); | 343 DCHECK_LE(buf_len, kMaxBufSize); |
344 | 344 |
345 if (io_state_ == STATE_DONE) | 345 if (io_state_ == STATE_DONE) |
346 return OK; | 346 return OK; |
347 | 347 |
348 // Must have response headers with a non-1xx error code. | |
349 DCHECK_NE(1, response_->headers->response_code() / 100); | |
350 | |
351 user_read_buf_ = buf; | 348 user_read_buf_ = buf; |
352 user_read_buf_len_ = buf_len; | 349 user_read_buf_len_ = buf_len; |
353 io_state_ = STATE_READ_BODY; | 350 io_state_ = STATE_READ_BODY; |
354 | 351 |
355 int result = DoLoop(OK); | 352 int result = DoLoop(OK); |
356 if (result == ERR_IO_PENDING) | 353 if (result == ERR_IO_PENDING) |
357 callback_ = callback; | 354 callback_ = callback; |
358 | 355 |
359 return result; | 356 return result; |
360 } | 357 } |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 request_body->IsInMemory() && | 1049 request_body->IsInMemory() && |
1053 request_body->size() > 0) { | 1050 request_body->size() > 0) { |
1054 size_t merged_size = request_headers.size() + request_body->size(); | 1051 size_t merged_size = request_headers.size() + request_body->size(); |
1055 if (merged_size <= kMaxMergedHeaderAndBodySize) | 1052 if (merged_size <= kMaxMergedHeaderAndBodySize) |
1056 return true; | 1053 return true; |
1057 } | 1054 } |
1058 return false; | 1055 return false; |
1059 } | 1056 } |
1060 | 1057 |
1061 } // namespace net | 1058 } // namespace net |
OLD | NEW |