Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: net/http/http_stream_parser.cc

Issue 8496016: Report ERR_CONTENT_LENGTH_MISMATCH when the count of bytes received doesn't match Content-Length. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Chunked encoding, test fix Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/url_request/url_request_http_job.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream_parser.cc
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
index 2a862204ff89bdc415a07f5ebad0f52d22070ecf..d9b4728be82894d583c09d8488ba07a3623dc331 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -534,8 +534,12 @@ int HttpStreamParser::DoReadBodyComplete(int result) {
// the only way to signal the end of a stream is to close the connection,
// so we don't treat that as an error, though in some cases we may not
// have completely received the resource.
- if (result == 0 && !IsResponseBodyComplete() && CanFindEndOfResponse())
- result = ERR_CONNECTION_CLOSED;
+ if (result == 0 && !IsResponseBodyComplete() && CanFindEndOfResponse()) {
+ if (chunked_decoder_.get())
+ result = ERR_INVALID_CHUNKED_ENCODING;
rvargas (doing something else) 2011/11/09 19:55:26 Note that this means we'll be using the same error
cbentzel 2011/11/09 20:40:53 I think it's OK to lump the chunked encoding error
+ else
+ result = ERR_CONTENT_LENGTH_MISMATCH;
+ }
// Filter incoming data if appropriate. FilterBuf may return an error.
if (result > 0 && chunked_decoder_.get()) {
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/url_request/url_request_http_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698