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

Unified Diff: net/url_request/url_request_http_job.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: Clear error 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/url_request/url_request_http_job.h ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_http_job.cc
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index 33887db79db6df7fb3a4efddac44bb901723e66d..a415c91c5f86ad5327cfe3654930fba4de6b6830 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -751,9 +751,6 @@ void URLRequestHttpJob::OnHeadersReceivedCallback(int result) {
void URLRequestHttpJob::OnReadCompleted(int result) {
read_in_progress_ = false;
- if (ShouldFixMismatchedContentLength(result))
- result = 0;
-
if (result == 0) {
NotifyDone(URLRequestStatus());
} else if (result < 0) {
@@ -1089,28 +1086,6 @@ void URLRequestHttpJob::ContinueDespiteLastError() {
&URLRequestHttpJob::OnStartCompleted, rv));
}
-bool URLRequestHttpJob::ShouldFixMismatchedContentLength(int rv) const {
- // Some servers send the body compressed, but specify the content length as
- // the uncompressed size. Although this violates the HTTP spec we want to
- // support it (as IE and FireFox do), but *only* for an exact match.
- // See http://crbug.com/79694.
- if (rv == net::ERR_CONNECTION_CLOSED) {
- if (request_ && request_->response_headers()) {
- int64 expected_length = request_->response_headers()->GetContentLength();
- VLOG(1) << __FUNCTION__ << "() "
- << "\"" << request_->url().spec() << "\""
- << " content-length = " << expected_length
- << " pre total = " << prefilter_bytes_read()
- << " post total = " << postfilter_bytes_read();
- if (postfilter_bytes_read() == expected_length) {
- // Clear the error.
- return true;
- }
- }
- }
- return false;
-}
-
bool URLRequestHttpJob::ReadRawData(IOBuffer* buf, int buf_size,
int* bytes_read) {
DCHECK_NE(buf_size, 0);
@@ -1119,9 +1094,6 @@ bool URLRequestHttpJob::ReadRawData(IOBuffer* buf, int buf_size,
int rv = transaction_->Read(buf, buf_size, &read_callback_);
- if (ShouldFixMismatchedContentLength(rv))
- rv = 0;
-
if (rv >= 0) {
*bytes_read = rv;
if (!rv)
« no previous file with comments | « net/url_request/url_request_http_job.h ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698