| 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 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 | 1016 |
| 1017 priority_ = priority; | 1017 priority_ = priority; |
| 1018 if (job_.get()) { | 1018 if (job_.get()) { |
| 1019 net_log_.AddEvent( | 1019 net_log_.AddEvent( |
| 1020 NetLog::TYPE_URL_REQUEST_SET_PRIORITY, | 1020 NetLog::TYPE_URL_REQUEST_SET_PRIORITY, |
| 1021 NetLog::StringCallback("priority", RequestPriorityToString(priority_))); | 1021 NetLog::StringCallback("priority", RequestPriorityToString(priority_))); |
| 1022 job_->SetPriority(priority_); | 1022 job_->SetPriority(priority_); |
| 1023 } | 1023 } |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 bool URLRequest::GetHSTSRedirect(GURL* redirect_url) const { | |
| 1027 const GURL& url = this->url(); | |
| 1028 bool scheme_is_http = url.SchemeIs("http"); | |
| 1029 if (!scheme_is_http && !url.SchemeIs("ws")) | |
| 1030 return false; | |
| 1031 TransportSecurityState* state = context()->transport_security_state(); | |
| 1032 if (state && state->ShouldUpgradeToSSL(url.host())) { | |
| 1033 GURL::Replacements replacements; | |
| 1034 const char* new_scheme = scheme_is_http ? "https" : "wss"; | |
| 1035 replacements.SetSchemeStr(new_scheme); | |
| 1036 *redirect_url = url.ReplaceComponents(replacements); | |
| 1037 return true; | |
| 1038 } | |
| 1039 return false; | |
| 1040 } | |
| 1041 | |
| 1042 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) { | 1026 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) { |
| 1043 NetworkDelegate::AuthRequiredResponse rv = | 1027 NetworkDelegate::AuthRequiredResponse rv = |
| 1044 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; | 1028 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; |
| 1045 auth_info_ = auth_info; | 1029 auth_info_ = auth_info; |
| 1046 if (network_delegate_) { | 1030 if (network_delegate_) { |
| 1047 OnCallToDelegate(); | 1031 OnCallToDelegate(); |
| 1048 rv = network_delegate_->NotifyAuthRequired( | 1032 rv = network_delegate_->NotifyAuthRequired( |
| 1049 this, | 1033 this, |
| 1050 *auth_info, | 1034 *auth_info, |
| 1051 base::Bind(&URLRequest::NotifyAuthRequiredComplete, | 1035 base::Bind(&URLRequest::NotifyAuthRequiredComplete, |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 } | 1186 } |
| 1203 | 1187 |
| 1204 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { | 1188 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { |
| 1205 if (job_) | 1189 if (job_) |
| 1206 job_->GetConnectionAttempts(out); | 1190 job_->GetConnectionAttempts(out); |
| 1207 else | 1191 else |
| 1208 out->clear(); | 1192 out->clear(); |
| 1209 } | 1193 } |
| 1210 | 1194 |
| 1211 } // namespace net | 1195 } // namespace net |
| OLD | NEW |