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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #include "net/url_request/url_request.h" | 48 #include "net/url_request/url_request.h" |
49 #include "net/url_request/url_request_backoff_manager.h" | 49 #include "net/url_request/url_request_backoff_manager.h" |
50 #include "net/url_request/url_request_context.h" | 50 #include "net/url_request/url_request_context.h" |
51 #include "net/url_request/url_request_error_job.h" | 51 #include "net/url_request/url_request_error_job.h" |
52 #include "net/url_request/url_request_job_factory.h" | 52 #include "net/url_request/url_request_job_factory.h" |
53 #include "net/url_request/url_request_redirect_job.h" | 53 #include "net/url_request/url_request_redirect_job.h" |
54 #include "net/url_request/url_request_throttler_manager.h" | 54 #include "net/url_request/url_request_throttler_manager.h" |
55 #include "net/websockets/websocket_handshake_stream_base.h" | 55 #include "net/websockets/websocket_handshake_stream_base.h" |
56 #include "url/origin.h" | 56 #include "url/origin.h" |
57 | 57 |
| 58 #include "base/trace_event/trace_event.h" |
| 59 |
58 static const char kAvailDictionaryHeader[] = "Avail-Dictionary"; | 60 static const char kAvailDictionaryHeader[] = "Avail-Dictionary"; |
59 | 61 |
60 namespace { | 62 namespace { |
61 | 63 |
62 // True if the request method is "safe" (per section 4.2.1 of RFC 7231). | 64 // True if the request method is "safe" (per section 4.2.1 of RFC 7231). |
63 bool IsMethodSafe(const std::string& method) { | 65 bool IsMethodSafe(const std::string& method) { |
64 return method == "GET" || method == "HEAD" || method == "OPTIONS" || | 66 return method == "GET" || method == "HEAD" || method == "OPTIONS" || |
65 method == "TRACE"; | 67 method == "TRACE"; |
66 } | 68 } |
67 | 69 |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 void URLRequestHttpJob::OnHeadersReceivedCallback(int result) { | 1029 void URLRequestHttpJob::OnHeadersReceivedCallback(int result) { |
1028 awaiting_callback_ = false; | 1030 awaiting_callback_ = false; |
1029 | 1031 |
1030 // Check that there are no callbacks to already canceled requests. | 1032 // Check that there are no callbacks to already canceled requests. |
1031 DCHECK_NE(URLRequestStatus::CANCELED, GetStatus().status()); | 1033 DCHECK_NE(URLRequestStatus::CANCELED, GetStatus().status()); |
1032 | 1034 |
1033 SaveCookiesAndNotifyHeadersComplete(result); | 1035 SaveCookiesAndNotifyHeadersComplete(result); |
1034 } | 1036 } |
1035 | 1037 |
1036 void URLRequestHttpJob::OnReadCompleted(int result) { | 1038 void URLRequestHttpJob::OnReadCompleted(int result) { |
| 1039 TRACE_EVENT0("net", "net::URLRequestHttpJob::OnReadCompleted"); |
1037 read_in_progress_ = false; | 1040 read_in_progress_ = false; |
1038 | 1041 |
1039 DCHECK_NE(ERR_IO_PENDING, result); | 1042 DCHECK_NE(ERR_IO_PENDING, result); |
1040 | 1043 |
1041 if (ShouldFixMismatchedContentLength(result)) | 1044 if (ShouldFixMismatchedContentLength(result)) |
1042 result = OK; | 1045 result = OK; |
1043 | 1046 |
1044 // EOF or error, done with this job. | 1047 // EOF or error, done with this job. |
1045 if (result <= 0) | 1048 if (result <= 0) |
1046 DoneWithRequest(FINISHED); | 1049 DoneWithRequest(FINISHED); |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 return override_response_headers_.get() ? | 1604 return override_response_headers_.get() ? |
1602 override_response_headers_.get() : | 1605 override_response_headers_.get() : |
1603 transaction_->GetResponseInfo()->headers.get(); | 1606 transaction_->GetResponseInfo()->headers.get(); |
1604 } | 1607 } |
1605 | 1608 |
1606 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1609 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
1607 awaiting_callback_ = false; | 1610 awaiting_callback_ = false; |
1608 } | 1611 } |
1609 | 1612 |
1610 } // namespace net | 1613 } // namespace net |
OLD | NEW |