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 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. | 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. |
6 | 6 |
7 #include "webkit/glue/weburlloader_impl.h" | 7 #include "webkit/glue/weburlloader_impl.h" |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 } | 585 } |
586 } | 586 } |
587 | 587 |
588 void WebURLLoaderImpl::Context::OnReceivedCachedMetadata( | 588 void WebURLLoaderImpl::Context::OnReceivedCachedMetadata( |
589 const char* data, int len) { | 589 const char* data, int len) { |
590 if (client_) | 590 if (client_) |
591 client_->didReceiveCachedMetadata(loader_, data, len); | 591 client_->didReceiveCachedMetadata(loader_, data, len); |
592 } | 592 } |
593 | 593 |
594 void WebURLLoaderImpl::Context::OnCompletedRequest( | 594 void WebURLLoaderImpl::Context::OnCompletedRequest( |
595 const net::URLRequestStatus& status, | 595 const net::URLRequestStatus& original_status, |
596 const std::string& security_info, | 596 const std::string& security_info, |
597 const base::Time& completion_time) { | 597 const base::Time& completion_time) { |
598 if (ftp_listing_delegate_.get()) { | 598 if (ftp_listing_delegate_.get()) { |
599 ftp_listing_delegate_->OnCompletedRequest(); | 599 ftp_listing_delegate_->OnCompletedRequest(); |
600 ftp_listing_delegate_.reset(NULL); | 600 ftp_listing_delegate_.reset(NULL); |
601 } else if (multipart_delegate_.get()) { | 601 } else if (multipart_delegate_.get()) { |
602 multipart_delegate_->OnCompletedRequest(); | 602 multipart_delegate_->OnCompletedRequest(); |
603 multipart_delegate_.reset(NULL); | 603 multipart_delegate_.reset(NULL); |
604 } | 604 } |
605 | 605 |
| 606 net::URLRequestStatus status = original_status; |
| 607 |
| 608 // Rewrite the Content-Length mismatch as a success. |
| 609 // See crbug.com/52847 for justification. |
| 610 if (status.status() != net::URLRequestStatus::SUCCESS && |
| 611 status.error() == net::ERR_CONTENT_LENGTH_MISMATCH) { |
| 612 status.set_status(net::URLRequestStatus::SUCCESS); |
| 613 status.set_error(net::OK); |
| 614 } |
| 615 |
606 // Prevent any further IPC to the browser now that we're complete, but | 616 // Prevent any further IPC to the browser now that we're complete, but |
607 // don't delete it to keep any downloaded temp files alive. | 617 // don't delete it to keep any downloaded temp files alive. |
608 DCHECK(!completed_bridge_.get()); | 618 DCHECK(!completed_bridge_.get()); |
609 completed_bridge_.swap(bridge_); | 619 completed_bridge_.swap(bridge_); |
610 | 620 |
611 if (client_) { | 621 if (client_) { |
612 if (status.status() != net::URLRequestStatus::SUCCESS) { | 622 if (status.status() != net::URLRequestStatus::SUCCESS) { |
613 int error_code; | 623 int error_code; |
614 if (status.status() == net::URLRequestStatus::HANDLED_EXTERNALLY) { | 624 if (status.status() == net::URLRequestStatus::HANDLED_EXTERNALLY) { |
615 // By marking this request as aborted we insure that we don't navigate | 625 // By marking this request as aborted we insure that we don't navigate |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 | 735 |
726 void WebURLLoaderImpl::setDefersLoading(bool value) { | 736 void WebURLLoaderImpl::setDefersLoading(bool value) { |
727 context_->SetDefersLoading(value); | 737 context_->SetDefersLoading(value); |
728 } | 738 } |
729 | 739 |
730 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { | 740 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { |
731 context_->UpdateRoutingId(new_routing_id); | 741 context_->UpdateRoutingId(new_routing_id); |
732 } | 742 } |
733 | 743 |
734 } // namespace webkit_glue | 744 } // namespace webkit_glue |
OLD | NEW |