Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: net/url_request/url_request.cc

Issue 103803012: Make HSTS headers not clobber preloaded pins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to comments and fix compilation errors. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 net_log_.AddEvent(NetLog::TYPE_URL_REQUEST_SET_PRIORITY, 1058 net_log_.AddEvent(NetLog::TYPE_URL_REQUEST_SET_PRIORITY,
1059 NetLog::IntegerCallback("priority", priority_)); 1059 NetLog::IntegerCallback("priority", priority_));
1060 job_->SetPriority(priority_); 1060 job_->SetPriority(priority_);
1061 } 1061 }
1062 } 1062 }
1063 1063
1064 bool URLRequest::GetHSTSRedirect(GURL* redirect_url) const { 1064 bool URLRequest::GetHSTSRedirect(GURL* redirect_url) const {
1065 const GURL& url = this->url(); 1065 const GURL& url = this->url();
1066 if (!url.SchemeIs("http")) 1066 if (!url.SchemeIs("http"))
1067 return false; 1067 return false;
1068 TransportSecurityState::DomainState domain_state; 1068 TransportSecurityState* state = context()->transport_security_state();
1069 if (context()->transport_security_state() && 1069 if (state &&
1070 context()->transport_security_state()->GetDomainState( 1070 state->ShouldUpgradeToSSL(
1071 url.host(), 1071 url.host(),
1072 SSLConfigService::IsSNIAvailable(context()->ssl_config_service()), 1072 SSLConfigService::IsSNIAvailable(context()->ssl_config_service()))) {
1073 &domain_state) &&
1074 domain_state.ShouldUpgradeToSSL()) {
1075 url::Replacements<char> replacements; 1073 url::Replacements<char> replacements;
1076 const char kNewScheme[] = "https"; 1074 const char kNewScheme[] = "https";
1077 replacements.SetScheme(kNewScheme, url::Component(0, strlen(kNewScheme))); 1075 replacements.SetScheme(kNewScheme, url::Component(0, strlen(kNewScheme)));
1078 *redirect_url = url.ReplaceComponents(replacements); 1076 *redirect_url = url.ReplaceComponents(replacements);
1079 return true; 1077 return true;
1080 } 1078 }
1081 return false; 1079 return false;
1082 } 1080 }
1083 1081
1084 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) { 1082 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 new base::debug::StackTrace(NULL, 0); 1246 new base::debug::StackTrace(NULL, 0);
1249 *stack_trace_copy = stack_trace; 1247 *stack_trace_copy = stack_trace;
1250 stack_trace_.reset(stack_trace_copy); 1248 stack_trace_.reset(stack_trace_copy);
1251 } 1249 }
1252 1250
1253 const base::debug::StackTrace* URLRequest::stack_trace() const { 1251 const base::debug::StackTrace* URLRequest::stack_trace() const {
1254 return stack_trace_.get(); 1252 return stack_trace_.get();
1255 } 1253 }
1256 1254
1257 } // namespace net 1255 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698