DescriptionIf 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
Messages
Total messages: 8 (0 generated)
|