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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 | 337 |
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 | |
348 // Must have response headers with a non-1xx error code. | |
349 DCHECK_NE(1, response_->headers->response_code() / 100); | 347 DCHECK_NE(1, response_->headers->response_code() / 100); |
willchan no longer on Chromium
2014/05/15 08:49:02
I'm confused, don't you need to delete this DCHECK
mmenke
2014/05/15 12:20:07
Erm...oops. Added it back for local testing of th
| |
350 | 348 |
351 user_read_buf_ = buf; | 349 user_read_buf_ = buf; |
352 user_read_buf_len_ = buf_len; | 350 user_read_buf_len_ = buf_len; |
353 io_state_ = STATE_READ_BODY; | 351 io_state_ = STATE_READ_BODY; |
354 | 352 |
355 int result = DoLoop(OK); | 353 int result = DoLoop(OK); |
356 if (result == ERR_IO_PENDING) | 354 if (result == ERR_IO_PENDING) |
357 callback_ = callback; | 355 callback_ = callback; |
358 | 356 |
359 return result; | 357 return result; |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1052 request_body->IsInMemory() && | 1050 request_body->IsInMemory() && |
1053 request_body->size() > 0) { | 1051 request_body->size() > 0) { |
1054 size_t merged_size = request_headers.size() + request_body->size(); | 1052 size_t merged_size = request_headers.size() + request_body->size(); |
1055 if (merged_size <= kMaxMergedHeaderAndBodySize) | 1053 if (merged_size <= kMaxMergedHeaderAndBodySize) |
1056 return true; | 1054 return true; |
1057 } | 1055 } |
1058 return false; | 1056 return false; |
1059 } | 1057 } |
1060 | 1058 |
1061 } // namespace net | 1059 } // namespace net |
OLD | NEW |