OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
527 DCHECK_EQ(0, read_buf_->offset()); | 527 DCHECK_EQ(0, read_buf_->offset()); |
528 return connection_->socket()->Read(user_read_buf_, user_read_buf_len_, | 528 return connection_->socket()->Read(user_read_buf_, user_read_buf_len_, |
529 &io_callback_); | 529 &io_callback_); |
530 } | 530 } |
531 | 531 |
532 int HttpStreamParser::DoReadBodyComplete(int result) { | 532 int HttpStreamParser::DoReadBodyComplete(int result) { |
533 // If we didn't get a Content-Length and aren't using a chunked encoding, | 533 // If we didn't get a Content-Length and aren't using a chunked encoding, |
534 // the only way to signal the end of a stream is to close the connection, | 534 // the only way to signal the end of a stream is to close the connection, |
535 // so we don't treat that as an error, though in some cases we may not | 535 // so we don't treat that as an error, though in some cases we may not |
536 // have completely received the resource. | 536 // have completely received the resource. |
537 if (result == 0 && !IsResponseBodyComplete() && CanFindEndOfResponse()) | 537 if (result == 0 && !IsResponseBodyComplete() && CanFindEndOfResponse()) |
rvargas (doing something else)
2011/11/08 23:27:47
This not only includes content-length mismatch, bu
cbentzel
2011/11/09 01:26:09
Good point. I could imagine a new error code. I'll
cbentzel
2011/11/09 18:17:36
I tested with FF4 and FF8. Need to test with other
cbentzel
2011/11/09 18:48:35
Safari 5.1.1 on Windows will fail if the Chunked-E
| |
538 result = ERR_CONNECTION_CLOSED; | 538 result = ERR_CONTENT_LENGTH_MISMATCH; |
539 | 539 |
540 // Filter incoming data if appropriate. FilterBuf may return an error. | 540 // Filter incoming data if appropriate. FilterBuf may return an error. |
541 if (result > 0 && chunked_decoder_.get()) { | 541 if (result > 0 && chunked_decoder_.get()) { |
542 result = chunked_decoder_->FilterBuf(user_read_buf_->data(), result); | 542 result = chunked_decoder_->FilterBuf(user_read_buf_->data(), result); |
543 if (result == 0 && !chunked_decoder_->reached_eof()) { | 543 if (result == 0 && !chunked_decoder_->reached_eof()) { |
544 // Don't signal completion of the Read call yet or else it'll look like | 544 // Don't signal completion of the Read call yet or else it'll look like |
545 // we received end-of-file. Wait for more data. | 545 // we received end-of-file. Wait for more data. |
546 io_state_ = STATE_READ_BODY; | 546 io_state_ = STATE_READ_BODY; |
547 return OK; | 547 return OK; |
548 } | 548 } |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
762 void HttpStreamParser::GetSSLCertRequestInfo( | 762 void HttpStreamParser::GetSSLCertRequestInfo( |
763 SSLCertRequestInfo* cert_request_info) { | 763 SSLCertRequestInfo* cert_request_info) { |
764 if (request_->url.SchemeIs("https") && connection_->socket()) { | 764 if (request_->url.SchemeIs("https") && connection_->socket()) { |
765 SSLClientSocket* ssl_socket = | 765 SSLClientSocket* ssl_socket = |
766 static_cast<SSLClientSocket*>(connection_->socket()); | 766 static_cast<SSLClientSocket*>(connection_->socket()); |
767 ssl_socket->GetSSLCertRequestInfo(cert_request_info); | 767 ssl_socket->GetSSLCertRequestInfo(cert_request_info); |
768 } | 768 } |
769 } | 769 } |
770 | 770 |
771 } // namespace net | 771 } // namespace net |
OLD | NEW |