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 bug: 79694. | |
Randy Smith (Not in Mondays)
2011/05/03 21:30:41
I think the proper format for this last is "See ht
ahendrickson
2011/05/04 15:08:25
Done.
| |
292 if (status.os_error() == net::ERR_CONNECTION_CLOSED) { | |
293 if (request_ && request_->response_headers()) { | |
294 if (postfilter_bytes_read() == | |
295 request_->response_headers()->GetContentLength()) { | |
296 // Clear the error. | |
297 status = URLRequestStatus(); | |
298 } | |
299 } | |
300 } | |
301 | |
287 RecordCompressionHistograms(); | 302 RecordCompressionHistograms(); |
288 URLRequestJob::NotifyDone(status); | 303 URLRequestJob::NotifyDone(status); |
289 } | 304 } |
290 | 305 |
291 void URLRequestHttpJob::DestroyTransaction() { | 306 void URLRequestHttpJob::DestroyTransaction() { |
292 DCHECK(transaction_.get()); | 307 DCHECK(transaction_.get()); |
293 | 308 |
294 transaction_.reset(); | 309 transaction_.reset(); |
295 response_info_ = NULL; | 310 response_info_ = NULL; |
296 context_ = NULL; | 311 context_ = NULL; |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1369 } | 1384 } |
1370 | 1385 |
1371 bool URLRequestHttpJob::IsCompressibleContent() const { | 1386 bool URLRequestHttpJob::IsCompressibleContent() const { |
1372 std::string mime_type; | 1387 std::string mime_type; |
1373 return GetMimeType(&mime_type) && | 1388 return GetMimeType(&mime_type) && |
1374 (IsSupportedJavascriptMimeType(mime_type.c_str()) || | 1389 (IsSupportedJavascriptMimeType(mime_type.c_str()) || |
1375 IsSupportedNonImageMimeType(mime_type.c_str())); | 1390 IsSupportedNonImageMimeType(mime_type.c_str())); |
1376 } | 1391 } |
1377 | 1392 |
1378 } // namespace net | 1393 } // namespace net |
OLD | NEW |