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 class URLRequestHttpJob::HttpFilterContext : public FilterContext { | 53 class URLRequestHttpJob::HttpFilterContext : public FilterContext { |
53 public: | 54 public: |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1017 | 1018 |
1018 return !encoding_types.empty() | 1019 return !encoding_types.empty() |
1019 ? Filter::Factory(encoding_types, *filter_context_) : NULL; | 1020 ? Filter::Factory(encoding_types, *filter_context_) : NULL; |
1020 } | 1021 } |
1021 | 1022 |
1022 bool URLRequestHttpJob::IsSafeRedirect(const GURL& location) { | 1023 bool URLRequestHttpJob::IsSafeRedirect(const GURL& location) { |
1023 // We only allow redirects to certain "safe" protocols. This does not | 1024 // We only allow redirects to certain "safe" protocols. This does not |
1024 // restrict redirects to externally handled protocols. Our consumer would | 1025 // restrict redirects to externally handled protocols. Our consumer would |
1025 // need to take care of those. | 1026 // need to take care of those. |
1026 | 1027 |
1027 if (!URLRequest::IsHandledURL(location)) | 1028 if (!(URLRequest::IsHandledURL(location) || |
1029 request_->context()->job_factory()->IsHandledURL(location))) { | |
mmenke
2012/08/24 14:23:45
nit: Suggest
!URLRequest::IsHandledURL(location)
Zulkarnainmegat42
2017/07/21 06:59:53
On 2012/08/24 14:23:45, mmenke wrote:
> <font><fon
| |
1028 return true; | 1030 return true; |
1031 } | |
1029 | 1032 |
1030 static const char* kSafeSchemes[] = { | 1033 static const char* kSafeSchemes[] = { |
1031 "http", | 1034 "http", |
1032 "https", | 1035 "https", |
1033 "ftp" | 1036 "ftp" |
1034 }; | 1037 }; |
1035 | 1038 |
1036 for (size_t i = 0; i < arraysize(kSafeSchemes); ++i) { | 1039 for (size_t i = 0; i < arraysize(kSafeSchemes); ++i) { |
1037 if (location.SchemeIs(kSafeSchemes[i])) | 1040 if (location.SchemeIs(kSafeSchemes[i])) |
1038 return true; | 1041 return true; |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1497 | 1500 |
1498 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1501 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
1499 awaiting_callback_ = false; | 1502 awaiting_callback_ = false; |
1500 } | 1503 } |
1501 | 1504 |
1502 void URLRequestHttpJob::OnDetachRequest() { | 1505 void URLRequestHttpJob::OnDetachRequest() { |
1503 http_transaction_delegate_->OnDetachRequest(); | 1506 http_transaction_delegate_->OnDetachRequest(); |
1504 } | 1507 } |
1505 | 1508 |
1506 } // namespace net | 1509 } // namespace net |
OLD | NEW |