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 (redirect_url && !url.SchemeIs("http")) | 922 if (!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()); | |
927 if (context()->transport_security_state() && | 925 if (context()->transport_security_state() && |
928 context()->transport_security_state()->GetDomainState( | 926 context()->transport_security_state()->GetDomainState( |
929 url.host(), | 927 url.host(), |
930 SSLConfigService::IsSNIAvailable(context()->ssl_config_service()), | 928 SSLConfigService::IsSNIAvailable(context()->ssl_config_service()), |
931 allow_dynamic_state, | |
932 &domain_state) && | 929 &domain_state) && |
933 domain_state.ShouldUpgradeToSSL()) { | 930 domain_state.ShouldUpgradeToSSL()) { |
934 if (redirect_url) { | 931 url_canon::Replacements<char> replacements; |
935 url_canon::Replacements<char> replacements; | 932 const char kNewScheme[] = "https"; |
936 const char kNewScheme[] = "https"; | 933 replacements.SetScheme(kNewScheme, |
937 replacements.SetScheme(kNewScheme, | 934 url_parse::Component(0, strlen(kNewScheme))); |
938 url_parse::Component(0, strlen(kNewScheme))); | 935 *redirect_url = url.ReplaceComponents(replacements); |
939 *redirect_url = url.ReplaceComponents(replacements); | |
940 } | |
941 return true; | 936 return true; |
942 } | 937 } |
943 return false; | 938 return false; |
944 } | 939 } |
945 | 940 |
946 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) { | 941 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) { |
947 NetworkDelegate::AuthRequiredResponse rv = | 942 NetworkDelegate::AuthRequiredResponse rv = |
948 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; | 943 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; |
949 auth_info_ = auth_info; | 944 auth_info_ = auth_info; |
950 if (network_delegate_) { | 945 if (network_delegate_) { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 new base::debug::StackTrace(NULL, 0); | 1108 new base::debug::StackTrace(NULL, 0); |
1114 *stack_trace_copy = stack_trace; | 1109 *stack_trace_copy = stack_trace; |
1115 stack_trace_.reset(stack_trace_copy); | 1110 stack_trace_.reset(stack_trace_copy); |
1116 } | 1111 } |
1117 | 1112 |
1118 const base::debug::StackTrace* URLRequest::stack_trace() const { | 1113 const base::debug::StackTrace* URLRequest::stack_trace() const { |
1119 return stack_trace_.get(); | 1114 return stack_trace_.get(); |
1120 } | 1115 } |
1121 | 1116 |
1122 } // namespace net | 1117 } // namespace net |
OLD | NEW |