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 25 matching lines...) Expand all Loading... | |
36 #include "net/http/http_status_code.h" | 36 #include "net/http/http_status_code.h" |
37 #include "net/http/http_transaction.h" | 37 #include "net/http/http_transaction.h" |
38 #include "net/http/http_transaction_delegate.h" | 38 #include "net/http/http_transaction_delegate.h" |
39 #include "net/http/http_transaction_factory.h" | 39 #include "net/http/http_transaction_factory.h" |
40 #include "net/http/http_util.h" | 40 #include "net/http/http_util.h" |
41 #include "net/url_request/fraudulent_certificate_reporter.h" | 41 #include "net/url_request/fraudulent_certificate_reporter.h" |
42 #include "net/url_request/http_user_agent_settings.h" | 42 #include "net/url_request/http_user_agent_settings.h" |
43 #include "net/url_request/url_request.h" | 43 #include "net/url_request/url_request.h" |
44 #include "net/url_request/url_request_context.h" | 44 #include "net/url_request/url_request_context.h" |
45 #include "net/url_request/url_request_error_job.h" | 45 #include "net/url_request/url_request_error_job.h" |
46 #include "net/url_request/url_request_job_factory.h" | |
46 #include "net/url_request/url_request_redirect_job.h" | 47 #include "net/url_request/url_request_redirect_job.h" |
47 #include "net/url_request/url_request_throttler_header_adapter.h" | 48 #include "net/url_request/url_request_throttler_header_adapter.h" |
48 #include "net/url_request/url_request_throttler_manager.h" | 49 #include "net/url_request/url_request_throttler_manager.h" |
49 | 50 |
50 static const char kAvailDictionaryHeader[] = "Avail-Dictionary"; | 51 static const char kAvailDictionaryHeader[] = "Avail-Dictionary"; |
51 | 52 |
52 namespace net { | 53 namespace net { |
53 | 54 |
54 class URLRequestHttpJob::HttpFilterContext : public FilterContext { | 55 class URLRequestHttpJob::HttpFilterContext : public FilterContext { |
55 public: | 56 public: |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1010 | 1011 |
1011 return !encoding_types.empty() | 1012 return !encoding_types.empty() |
1012 ? Filter::Factory(encoding_types, *filter_context_) : NULL; | 1013 ? Filter::Factory(encoding_types, *filter_context_) : NULL; |
1013 } | 1014 } |
1014 | 1015 |
1015 bool URLRequestHttpJob::IsSafeRedirect(const GURL& location) { | 1016 bool URLRequestHttpJob::IsSafeRedirect(const GURL& location) { |
1016 // We only allow redirects to certain "safe" protocols. This does not | 1017 // We only allow redirects to certain "safe" protocols. This does not |
1017 // restrict redirects to externally handled protocols. Our consumer would | 1018 // restrict redirects to externally handled protocols. Our consumer would |
1018 // need to take care of those. | 1019 // need to take care of those. |
1019 | 1020 |
1020 if (!URLRequest::IsHandledURL(location)) | 1021 if (!URLRequest::IsHandledURL(location) && |
1022 !request_->context()->job_factory()->IsHandledURL(location)) { | |
mmenke
2013/01/22 16:50:37
I believe this may change behavior. In particular
pauljensen
2013/01/23 21:43:33
What makes a redirect "unsafe"? The only descript
mmenke
2013/01/23 22:09:17
I believe it encompasses everything we don't want
pauljensen
2013/01/28 19:51:49
Why wouldn't we want websites to redirect to somet
| |
1021 return true; | 1023 return true; |
1024 } | |
1022 | 1025 |
1023 static const char* kSafeSchemes[] = { | 1026 static const char* kSafeSchemes[] = { |
1024 "http", | 1027 "http", |
1025 "https", | 1028 "https", |
1026 "ftp" | 1029 "ftp" |
1027 }; | 1030 }; |
1028 | 1031 |
1029 for (size_t i = 0; i < arraysize(kSafeSchemes); ++i) { | 1032 for (size_t i = 0; i < arraysize(kSafeSchemes); ++i) { |
1030 if (location.SchemeIs(kSafeSchemes[i])) | 1033 if (location.SchemeIs(kSafeSchemes[i])) |
1031 return true; | 1034 return true; |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1570 | 1573 |
1571 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1574 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
1572 awaiting_callback_ = false; | 1575 awaiting_callback_ = false; |
1573 } | 1576 } |
1574 | 1577 |
1575 void URLRequestHttpJob::OnDetachRequest() { | 1578 void URLRequestHttpJob::OnDetachRequest() { |
1576 http_transaction_delegate_->OnDetachRequest(); | 1579 http_transaction_delegate_->OnDetachRequest(); |
1577 } | 1580 } |
1578 | 1581 |
1579 } // namespace net | 1582 } // namespace net |
OLD | NEW |