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.h" | 5 #include "net/url_request/url_request.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 priority_ = priority; | 912 priority_ = priority; |
913 if (job_.get()) { | 913 if (job_.get()) { |
914 net_log_.AddEvent(NetLog::TYPE_URL_REQUEST_SET_PRIORITY, | 914 net_log_.AddEvent(NetLog::TYPE_URL_REQUEST_SET_PRIORITY, |
915 NetLog::IntegerCallback("priority", priority_)); | 915 NetLog::IntegerCallback("priority", priority_)); |
916 job_->SetPriority(priority_); | 916 job_->SetPriority(priority_); |
917 } | 917 } |
918 } | 918 } |
919 | 919 |
920 bool URLRequest::GetHSTSRedirect(GURL* redirect_url) const { | 920 bool URLRequest::GetHSTSRedirect(GURL* redirect_url) const { |
921 const GURL& url = this->url(); | 921 const GURL& url = this->url(); |
922 if (!url.SchemeIs("http")) | 922 if (redirect_url && !url.SchemeIs("http")) |
923 return false; | 923 return false; |
924 TransportSecurityState::DomainState domain_state; | 924 TransportSecurityState::DomainState domain_state; |
| 925 bool allow_dynamic_state = |
| 926 !(load_flags_ & LOAD_DO_NOT_SEND_COOKIES) && CanGetCookies(CookieList()); |
925 if (context()->transport_security_state() && | 927 if (context()->transport_security_state() && |
926 context()->transport_security_state()->GetDomainState( | 928 context()->transport_security_state()->GetDomainState( |
927 url.host(), | 929 url.host(), |
928 SSLConfigService::IsSNIAvailable(context()->ssl_config_service()), | 930 SSLConfigService::IsSNIAvailable(context()->ssl_config_service()), |
| 931 allow_dynamic_state, |
929 &domain_state) && | 932 &domain_state) && |
930 domain_state.ShouldUpgradeToSSL()) { | 933 domain_state.ShouldUpgradeToSSL()) { |
931 url_canon::Replacements<char> replacements; | 934 if (redirect_url) { |
932 const char kNewScheme[] = "https"; | 935 url_canon::Replacements<char> replacements; |
933 replacements.SetScheme(kNewScheme, | 936 const char kNewScheme[] = "https"; |
934 url_parse::Component(0, strlen(kNewScheme))); | 937 replacements.SetScheme(kNewScheme, |
935 *redirect_url = url.ReplaceComponents(replacements); | 938 url_parse::Component(0, strlen(kNewScheme))); |
| 939 *redirect_url = url.ReplaceComponents(replacements); |
| 940 } |
936 return true; | 941 return true; |
937 } | 942 } |
938 return false; | 943 return false; |
939 } | 944 } |
940 | 945 |
941 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) { | 946 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) { |
942 NetworkDelegate::AuthRequiredResponse rv = | 947 NetworkDelegate::AuthRequiredResponse rv = |
943 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; | 948 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; |
944 auth_info_ = auth_info; | 949 auth_info_ = auth_info; |
945 if (network_delegate_) { | 950 if (network_delegate_) { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 new base::debug::StackTrace(NULL, 0); | 1113 new base::debug::StackTrace(NULL, 0); |
1109 *stack_trace_copy = stack_trace; | 1114 *stack_trace_copy = stack_trace; |
1110 stack_trace_.reset(stack_trace_copy); | 1115 stack_trace_.reset(stack_trace_copy); |
1111 } | 1116 } |
1112 | 1117 |
1113 const base::debug::StackTrace* URLRequest::stack_trace() const { | 1118 const base::debug::StackTrace* URLRequest::stack_trace() const { |
1114 return stack_trace_.get(); | 1119 return stack_trace_.get(); |
1115 } | 1120 } |
1116 | 1121 |
1117 } // namespace net | 1122 } // namespace net |
OLD | NEW |