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 23 matching lines...) Expand all Loading... |
34 #include "net/http/http_response_info.h" | 34 #include "net/http/http_response_info.h" |
35 #include "net/http/http_status_code.h" | 35 #include "net/http/http_status_code.h" |
36 #include "net/http/http_transaction.h" | 36 #include "net/http/http_transaction.h" |
37 #include "net/http/http_transaction_delegate.h" | 37 #include "net/http/http_transaction_delegate.h" |
38 #include "net/http/http_transaction_factory.h" | 38 #include "net/http/http_transaction_factory.h" |
39 #include "net/http/http_util.h" | 39 #include "net/http/http_util.h" |
40 #include "net/url_request/fraudulent_certificate_reporter.h" | 40 #include "net/url_request/fraudulent_certificate_reporter.h" |
41 #include "net/url_request/url_request.h" | 41 #include "net/url_request/url_request.h" |
42 #include "net/url_request/url_request_context.h" | 42 #include "net/url_request/url_request_context.h" |
43 #include "net/url_request/url_request_error_job.h" | 43 #include "net/url_request/url_request_error_job.h" |
| 44 #include "net/url_request/url_request_job_factory.h" |
44 #include "net/url_request/url_request_redirect_job.h" | 45 #include "net/url_request/url_request_redirect_job.h" |
45 #include "net/url_request/url_request_throttler_header_adapter.h" | 46 #include "net/url_request/url_request_throttler_header_adapter.h" |
46 #include "net/url_request/url_request_throttler_manager.h" | 47 #include "net/url_request/url_request_throttler_manager.h" |
47 | 48 |
48 static const char kAvailDictionaryHeader[] = "Avail-Dictionary"; | 49 static const char kAvailDictionaryHeader[] = "Avail-Dictionary"; |
49 | 50 |
50 namespace net { | 51 namespace net { |
51 | 52 |
52 namespace { | 53 namespace { |
53 | 54 |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 | 1116 |
1116 return !encoding_types.empty() | 1117 return !encoding_types.empty() |
1117 ? Filter::Factory(encoding_types, *filter_context_) : NULL; | 1118 ? Filter::Factory(encoding_types, *filter_context_) : NULL; |
1118 } | 1119 } |
1119 | 1120 |
1120 bool URLRequestHttpJob::IsSafeRedirect(const GURL& location) { | 1121 bool URLRequestHttpJob::IsSafeRedirect(const GURL& location) { |
1121 // We only allow redirects to certain "safe" protocols. This does not | 1122 // We only allow redirects to certain "safe" protocols. This does not |
1122 // restrict redirects to externally handled protocols. Our consumer would | 1123 // restrict redirects to externally handled protocols. Our consumer would |
1123 // need to take care of those. | 1124 // need to take care of those. |
1124 | 1125 |
1125 if (!URLRequest::IsHandledURL(location)) | 1126 if (!(URLRequest::IsHandledURL(location) || |
| 1127 request_->context()->job_factory()->IsHandledURL(location))) { |
1126 return true; | 1128 return true; |
| 1129 } |
1127 | 1130 |
1128 static const char* kSafeSchemes[] = { | 1131 static const char* kSafeSchemes[] = { |
1129 "http", | 1132 "http", |
1130 "https", | 1133 "https", |
1131 "ftp" | 1134 "ftp" |
1132 }; | 1135 }; |
1133 | 1136 |
1134 for (size_t i = 0; i < arraysize(kSafeSchemes); ++i) { | 1137 for (size_t i = 0; i < arraysize(kSafeSchemes); ++i) { |
1135 if (location.SchemeIs(kSafeSchemes[i])) | 1138 if (location.SchemeIs(kSafeSchemes[i])) |
1136 return true; | 1139 return true; |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1627 | 1630 |
1628 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1631 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
1629 awaiting_callback_ = false; | 1632 awaiting_callback_ = false; |
1630 } | 1633 } |
1631 | 1634 |
1632 void URLRequestHttpJob::OnDetachRequest() { | 1635 void URLRequestHttpJob::OnDetachRequest() { |
1633 http_transaction_delegate_->OnDetachRequest(); | 1636 http_transaction_delegate_->OnDetachRequest(); |
1634 } | 1637 } |
1635 | 1638 |
1636 } // namespace net | 1639 } // namespace net |
OLD | NEW |