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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 | 1009 |
1010 priority_ = priority; | 1010 priority_ = priority; |
1011 if (job_.get()) { | 1011 if (job_.get()) { |
1012 net_log_.AddEvent( | 1012 net_log_.AddEvent( |
1013 NetLog::TYPE_URL_REQUEST_SET_PRIORITY, | 1013 NetLog::TYPE_URL_REQUEST_SET_PRIORITY, |
1014 NetLog::StringCallback("priority", RequestPriorityToString(priority_))); | 1014 NetLog::StringCallback("priority", RequestPriorityToString(priority_))); |
1015 job_->SetPriority(priority_); | 1015 job_->SetPriority(priority_); |
1016 } | 1016 } |
1017 } | 1017 } |
1018 | 1018 |
1019 bool URLRequest::GetHSTSRedirect(GURL* redirect_url) const { | |
1020 const GURL& url = this->url(); | |
1021 bool scheme_is_http = url.SchemeIs("http"); | |
1022 if (!scheme_is_http && !url.SchemeIs("ws")) | |
1023 return false; | |
1024 TransportSecurityState* state = context()->transport_security_state(); | |
1025 if (state && state->ShouldUpgradeToSSL(url.host())) { | |
1026 GURL::Replacements replacements; | |
1027 const char* new_scheme = scheme_is_http ? "https" : "wss"; | |
1028 replacements.SetSchemeStr(new_scheme); | |
1029 *redirect_url = url.ReplaceComponents(replacements); | |
1030 return true; | |
1031 } | |
1032 return false; | |
1033 } | |
1034 | |
1035 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) { | 1019 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) { |
1036 NetworkDelegate::AuthRequiredResponse rv = | 1020 NetworkDelegate::AuthRequiredResponse rv = |
1037 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; | 1021 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; |
1038 auth_info_ = auth_info; | 1022 auth_info_ = auth_info; |
1039 if (network_delegate_) { | 1023 if (network_delegate_) { |
1040 OnCallToDelegate(); | 1024 OnCallToDelegate(); |
1041 rv = network_delegate_->NotifyAuthRequired( | 1025 rv = network_delegate_->NotifyAuthRequired( |
1042 this, | 1026 this, |
1043 *auth_info, | 1027 *auth_info, |
1044 base::Bind(&URLRequest::NotifyAuthRequiredComplete, | 1028 base::Bind(&URLRequest::NotifyAuthRequiredComplete, |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1195 } | 1179 } |
1196 | 1180 |
1197 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { | 1181 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { |
1198 if (job_) | 1182 if (job_) |
1199 job_->GetConnectionAttempts(out); | 1183 job_->GetConnectionAttempts(out); |
1200 else | 1184 else |
1201 out->clear(); | 1185 out->clear(); |
1202 } | 1186 } |
1203 | 1187 |
1204 } // namespace net | 1188 } // namespace net |
OLD | NEW |