| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 if (rv == ERR_IO_PENDING) | 1320 if (rv == ERR_IO_PENDING) |
| 1321 return; | 1321 return; |
| 1322 | 1322 |
| 1323 // The transaction started synchronously, but we need to notify the | 1323 // The transaction started synchronously, but we need to notify the |
| 1324 // URLRequest delegate via the message loop. | 1324 // URLRequest delegate via the message loop. |
| 1325 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1325 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1326 FROM_HERE, base::Bind(&URLRequestHttpJob::OnStartCompleted, | 1326 FROM_HERE, base::Bind(&URLRequestHttpJob::OnStartCompleted, |
| 1327 weak_factory_.GetWeakPtr(), rv)); | 1327 weak_factory_.GetWeakPtr(), rv)); |
| 1328 } | 1328 } |
| 1329 | 1329 |
| 1330 void URLRequestHttpJob::ResumeNetworkStart() { | |
| 1331 DCHECK(transaction_.get()); | |
| 1332 transaction_->ResumeNetworkStart(); | |
| 1333 } | |
| 1334 | |
| 1335 bool URLRequestHttpJob::ShouldFixMismatchedContentLength(int rv) const { | 1330 bool URLRequestHttpJob::ShouldFixMismatchedContentLength(int rv) const { |
| 1336 // Some servers send the body compressed, but specify the content length as | 1331 // Some servers send the body compressed, but specify the content length as |
| 1337 // the uncompressed size. Although this violates the HTTP spec we want to | 1332 // the uncompressed size. Although this violates the HTTP spec we want to |
| 1338 // support it (as IE and FireFox do), but *only* for an exact match. | 1333 // support it (as IE and FireFox do), but *only* for an exact match. |
| 1339 // See http://crbug.com/79694. | 1334 // See http://crbug.com/79694. |
| 1340 if (rv == ERR_CONTENT_LENGTH_MISMATCH || | 1335 if (rv == ERR_CONTENT_LENGTH_MISMATCH || |
| 1341 rv == ERR_INCOMPLETE_CHUNKED_ENCODING) { | 1336 rv == ERR_INCOMPLETE_CHUNKED_ENCODING) { |
| 1342 if (request_ && request_->response_headers()) { | 1337 if (request_ && request_->response_headers()) { |
| 1343 int64_t expected_length = | 1338 int64_t expected_length = |
| 1344 request_->response_headers()->GetContentLength(); | 1339 request_->response_headers()->GetContentLength(); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 // Notify NetworkQualityEstimator. | 1600 // Notify NetworkQualityEstimator. |
| 1606 if (request()) { | 1601 if (request()) { |
| 1607 NetworkQualityEstimator* network_quality_estimator = | 1602 NetworkQualityEstimator* network_quality_estimator = |
| 1608 request()->context()->network_quality_estimator(); | 1603 request()->context()->network_quality_estimator(); |
| 1609 if (network_quality_estimator) | 1604 if (network_quality_estimator) |
| 1610 network_quality_estimator->NotifyURLRequestDestroyed(*request()); | 1605 network_quality_estimator->NotifyURLRequestDestroyed(*request()); |
| 1611 } | 1606 } |
| 1612 } | 1607 } |
| 1613 | 1608 |
| 1614 } // namespace net | 1609 } // namespace net |
| OLD | NEW |