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

Issue 9811006: Ignore Content-Length mismatches when Content-Length is too large. (Closed)

Created:
8 years, 9 months ago by cbentzel
Modified:
5 years, 7 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, tburkard+watch_chromium.org, jam, joi+watch-content_chromium.org, dominich+watch_chromium.org, darin-cc_chromium.org, rdsmith+dwatch_chromium.org, mmenke
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

If fewer bytes are transferred in an HTTP response body than are advertised by the Content-Length header when the connection is closed, treat it as a valid response. This used to be reported as ERR_CONNECTION_CLOSED. Unfortunately, there are a number of misconfigured servers on the web which report a Content-Length completely divorced from reality. Other browsers display whatever data was received without reporting errors in this case, and Chrome now does the same. An earlier CL reported this as an error (ERR_CONTENT_LENGTH_MISMATCH), and had the webkit glue layer rewrite this case as a successful response. Unfortunately, this led to incorrect state machine logic (and crashes) when the connection was closed before the MIME type sniffing in BufferedResourceHandler completed. If certain requests want to be alerted about this issue (such as URLFetcher or downloads) in the future, we could add a LOAD_FLAG to specify whether to return an error or treat the result as OK. Alternately, we could rewrite the URLRequestStatus in ResourceDispatcherHostImpl. BUG=52847 TEST=Manually, go to www.goldwarez.org and confirm that we do not crash. Added some browser tests as well to test, but I may remove these or need to find a better location. Also, net_unittests have been modified.

Patch Set 1 #

Patch Set 2 : More content_length tests #

Patch Set 3 : Different tests #

Patch Set 4 : Use text/plain to trigger content sniffing #

Patch Set 5 : Don't report error on content-length mismatch #

Patch Set 6 : Remove ERR_CONTENT_LENGTH_MISMATCH #

Patch Set 7 : Browser tests pass #

Patch Set 8 : Different test files #

Patch Set 9 : Remove funny comment #

Total comments: 2

Patch Set 10 : Undo bad local change #

Total comments: 2

Patch Set 11 : Remove browser_tests #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+36 lines, -64 lines) Patch
M content/browser/download/download_resource_handler.cc View 1 2 3 4 5 1 chunk +0 lines, -7 lines 0 comments Download
M net/http/http_network_transaction_spdy21_unittest.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M net/http/http_network_transaction_spdy2_unittest.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M net/http/http_network_transaction_spdy3_unittest.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M net/http/http_stream_parser.cc View 1 2 3 4 7 8 9 1 chunk +31 lines, -6 lines 3 comments Download
M net/url_request/url_request_http_job.h View 1 chunk +0 lines, -7 lines 0 comments Download
M net/url_request/url_request_http_job.cc View 1 2 3 4 3 chunks +0 lines, -28 lines 0 comments Download
M net/url_request/url_request_unittest.cc View 1 2 3 4 2 chunks +2 lines, -13 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
cbentzel
I'm trying to find a better place to put the browser_tests than prerender_browsertest - they ...
8 years, 9 months ago (2012-03-23 18:40:07 UTC) #1
rvargas (doing something else)
I may be missing something. https://chromiumcodereview.appspot.com/9811006/diff/9008/net/http/http_stream_parser.cc File net/http/http_stream_parser.cc (right): https://chromiumcodereview.appspot.com/9811006/diff/9008/net/http/http_stream_parser.cc#newcode694 net/http/http_stream_parser.cc:694: result = ERR_CONNECTION_CLOSED; So ...
8 years, 9 months ago (2012-03-23 20:50:29 UTC) #2
cbentzel
https://chromiumcodereview.appspot.com/9811006/diff/9008/net/http/http_stream_parser.cc File net/http/http_stream_parser.cc (right): https://chromiumcodereview.appspot.com/9811006/diff/9008/net/http/http_stream_parser.cc#newcode694 net/http/http_stream_parser.cc:694: result = ERR_CONNECTION_CLOSED; On 2012/03/23 20:50:29, rvargas wrote: > ...
8 years, 9 months ago (2012-03-23 21:19:20 UTC) #3
cbentzel
Wow, thanks for that catch. It would have been caught by trybots, but I shouldn't ...
8 years, 9 months ago (2012-03-23 21:21:50 UTC) #4
rvargas (doing something else)
I would actually remove the browser test. We are removing high level "hacks", and the ...
8 years, 9 months ago (2012-03-24 01:06:50 UTC) #5
cbentzel
https://chromiumcodereview.appspot.com/9811006/diff/12027/net/http/http_network_transaction_spdy21_unittest.cc File net/http/http_network_transaction_spdy21_unittest.cc (right): https://chromiumcodereview.appspot.com/9811006/diff/12027/net/http/http_network_transaction_spdy21_unittest.cc#newcode6168 net/http/http_network_transaction_spdy21_unittest.cc:6168: EXPECT_EQ(OK, rv); On 2012/03/24 01:06:50, rvargas wrote: > This ...
8 years, 9 months ago (2012-03-24 01:24:35 UTC) #6
wtc1
Drive-by review comments on patch set 11: Please feel free to ignore my comments. https://chromiumcodereview.appspot.com/9811006/diff/9010/net/http/http_stream_parser.cc ...
8 years, 9 months ago (2012-03-26 21:37:01 UTC) #7
cbentzel
8 years, 9 months ago (2012-03-27 17:57:42 UTC) #8
https://chromiumcodereview.appspot.com/9811006/diff/9010/net/http/http_stream...
File net/http/http_stream_parser.cc (right):

https://chromiumcodereview.appspot.com/9811006/diff/9010/net/http/http_stream...
net/http/http_stream_parser.cc:675: //    tolerant of it, so this is reported as
OK.
On 2012/03/26 21:37:02, wtc1 wrote:
> 
> If we report OK only for non-HTTPS, will that provide enough
> compatibility?

We'd have to measure this. As discussed off of this code review, I'm going to
land another change which improves the measurement for how frequently this event
happens.

Powered by Google App Engine
This is Rietveld 408576698