| 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 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 // If a UA receives more than one PKP header field in an HTTP | 830 // If a UA receives more than one PKP header field in an HTTP |
| 831 // response message over secure transport, then the UA MUST process | 831 // response message over secure transport, then the UA MUST process |
| 832 // only the first such header field. | 832 // only the first such header field. |
| 833 HttpResponseHeaders* headers = GetResponseHeaders(); | 833 HttpResponseHeaders* headers = GetResponseHeaders(); |
| 834 std::string value; | 834 std::string value; |
| 835 if (headers->EnumerateHeader(NULL, "Public-Key-Pins", &value)) | 835 if (headers->EnumerateHeader(NULL, "Public-Key-Pins", &value)) |
| 836 security_state->AddHPKPHeader(request_info_.url.host(), value, ssl_info); | 836 security_state->AddHPKPHeader(request_info_.url.host(), value, ssl_info); |
| 837 } | 837 } |
| 838 | 838 |
| 839 void URLRequestHttpJob::OnStartCompleted(int result) { | 839 void URLRequestHttpJob::OnStartCompleted(int result) { |
| 840 // TODO(vadimt): Remove ScopedTracker below once crbug.com/424359 is fixed. | |
| 841 tracked_objects::ScopedTracker tracking_profile( | |
| 842 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 843 "424359 URLRequestHttpJob::OnStartCompleted")); | |
| 844 | |
| 845 RecordTimer(); | 840 RecordTimer(); |
| 846 | 841 |
| 847 // If the request was destroyed, then there is no more work to do. | 842 // If the request was destroyed, then there is no more work to do. |
| 848 if (!request_) | 843 if (!request_) |
| 849 return; | 844 return; |
| 850 | 845 |
| 851 // If the job is done (due to cancellation), can just ignore this | 846 // If the job is done (due to cancellation), can just ignore this |
| 852 // notification. | 847 // notification. |
| 853 if (done_) | 848 if (done_) |
| 854 return; | 849 return; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 void URLRequestHttpJob::OnHeadersReceivedCallback(int result) { | 932 void URLRequestHttpJob::OnHeadersReceivedCallback(int result) { |
| 938 awaiting_callback_ = false; | 933 awaiting_callback_ = false; |
| 939 | 934 |
| 940 // Check that there are no callbacks to already canceled requests. | 935 // Check that there are no callbacks to already canceled requests. |
| 941 DCHECK_NE(URLRequestStatus::CANCELED, GetStatus().status()); | 936 DCHECK_NE(URLRequestStatus::CANCELED, GetStatus().status()); |
| 942 | 937 |
| 943 SaveCookiesAndNotifyHeadersComplete(result); | 938 SaveCookiesAndNotifyHeadersComplete(result); |
| 944 } | 939 } |
| 945 | 940 |
| 946 void URLRequestHttpJob::OnReadCompleted(int result) { | 941 void URLRequestHttpJob::OnReadCompleted(int result) { |
| 947 // TODO(vadimt): Remove ScopedTracker below once crbug.com/424359 is fixed. | |
| 948 tracked_objects::ScopedTracker tracking_profile( | |
| 949 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 950 "424359 URLRequestHttpJob::OnReadCompleted")); | |
| 951 | |
| 952 read_in_progress_ = false; | 942 read_in_progress_ = false; |
| 953 | 943 |
| 954 if (ShouldFixMismatchedContentLength(result)) | 944 if (ShouldFixMismatchedContentLength(result)) |
| 955 result = OK; | 945 result = OK; |
| 956 | 946 |
| 957 if (result == OK) { | 947 if (result == OK) { |
| 958 NotifyDone(URLRequestStatus()); | 948 NotifyDone(URLRequestStatus()); |
| 959 } else if (result < 0) { | 949 } else if (result < 0) { |
| 960 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result)); | 950 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result)); |
| 961 } else { | 951 } else { |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 return override_response_headers_.get() ? | 1485 return override_response_headers_.get() ? |
| 1496 override_response_headers_.get() : | 1486 override_response_headers_.get() : |
| 1497 transaction_->GetResponseInfo()->headers.get(); | 1487 transaction_->GetResponseInfo()->headers.get(); |
| 1498 } | 1488 } |
| 1499 | 1489 |
| 1500 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1490 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1501 awaiting_callback_ = false; | 1491 awaiting_callback_ = false; |
| 1502 } | 1492 } |
| 1503 | 1493 |
| 1504 } // namespace net | 1494 } // namespace net |
| OLD | NEW |