OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
276 // notified of the headers completion so that we can update the cookie store. | 276 // notified of the headers completion so that we can update the cookie store. |
277 if (transaction_->IsReadyToRestartForAuth()) { | 277 if (transaction_->IsReadyToRestartForAuth()) { |
278 DCHECK(!response_info_->auth_challenge.get()); | 278 DCHECK(!response_info_->auth_challenge.get()); |
279 RestartTransactionWithAuth(string16(), string16()); | 279 RestartTransactionWithAuth(string16(), string16()); |
280 return; | 280 return; |
281 } | 281 } |
282 | 282 |
283 URLRequestJob::NotifyHeadersComplete(); | 283 URLRequestJob::NotifyHeadersComplete(); |
284 } | 284 } |
285 | 285 |
286 void URLRequestHttpJob::NotifyDone(const URLRequestStatus& status) { | 286 void URLRequestHttpJob::NotifyDone(const URLRequestStatus& original_status) { |
287 URLRequestStatus status(original_status); | |
288 // Some servers send the body compressed, but specify the content length as | |
289 // the uncompressed size. Although this violates the HTTP spec we want to | |
290 // support it (as IE and FireFox do), but *only* for an exact match. | |
291 // See http://crbug.com/79694. | |
292 if (status.os_error() == net::ERR_CONNECTION_CLOSED) { | |
293 if (request_ && request_->response_headers()) { | |
294 int64 expected_length = request_->response_headers()->GetContentLength(); | |
295 VLOG(21) << __FUNCTION__ << "() " | |
296 << "\"" << request_->url().spec() << "\"" | |
297 << " content-length = " << expected_length | |
298 << " pre total = " << prefilter_bytes_read() | |
299 << " post total = " << postfilter_bytes_read(); | |
300 if (0 == expected_length || | |
301 postfilter_bytes_read() == expected_length || | |
302 prefilter_bytes_read() == expected_length) { | |
rvargas (doing something else)
2011/05/19 19:30:36
if expected_length is 0 or prefilter_bytes_read we
ahendrickson
2011/05/19 22:29:34
Done.
| |
303 // Clear the error. | |
304 status = URLRequestStatus(); | |
305 } | |
306 } | |
307 } | |
308 | |
287 RecordCompressionHistograms(); | 309 RecordCompressionHistograms(); |
288 URLRequestJob::NotifyDone(status); | 310 URLRequestJob::NotifyDone(status); |
289 } | 311 } |
290 | 312 |
291 void URLRequestHttpJob::DestroyTransaction() { | 313 void URLRequestHttpJob::DestroyTransaction() { |
292 DCHECK(transaction_.get()); | 314 DCHECK(transaction_.get()); |
293 | 315 |
294 transaction_.reset(); | 316 transaction_.reset(); |
295 response_info_ = NULL; | 317 response_info_ = NULL; |
296 context_ = NULL; | 318 context_ = NULL; |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1369 } | 1391 } |
1370 | 1392 |
1371 bool URLRequestHttpJob::IsCompressibleContent() const { | 1393 bool URLRequestHttpJob::IsCompressibleContent() const { |
1372 std::string mime_type; | 1394 std::string mime_type; |
1373 return GetMimeType(&mime_type) && | 1395 return GetMimeType(&mime_type) && |
1374 (IsSupportedJavascriptMimeType(mime_type.c_str()) || | 1396 (IsSupportedJavascriptMimeType(mime_type.c_str()) || |
1375 IsSupportedNonImageMimeType(mime_type.c_str())); | 1397 IsSupportedNonImageMimeType(mime_type.c_str())); |
1376 } | 1398 } |
1377 | 1399 |
1378 } // namespace net | 1400 } // namespace net |
OLD | NEW |