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

Side by Side Diff: net/http/http_stream_factory.cc

Issue 1525993004: AlternativeService - change the expiration time from 1 day to 30 days. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/http/http_stream_factory.h" 5 #include "net/http/http_stream_factory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 if (!is_valid || protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) { 148 if (!is_valid || protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) {
149 http_server_properties->ClearAlternativeServices(http_host_port_pair); 149 http_server_properties->ClearAlternativeServices(http_host_port_pair);
150 return; 150 return;
151 } 151 }
152 152
153 http_server_properties->SetAlternativeService( 153 http_server_properties->SetAlternativeService(
154 RewriteHost(http_host_port_pair), 154 RewriteHost(http_host_port_pair),
155 AlternativeService(protocol, "", static_cast<uint16>(port)), probability, 155 AlternativeService(protocol, "", static_cast<uint16>(port)), probability,
156 base::Time::Now() + base::TimeDelta::FromDays(1)); 156 base::Time::Now() + base::TimeDelta::FromDays(30));
ramant (doing other things) 2015/12/16 00:06:34 Hi Ryan, We are setting 1 day expiration for kAl
157 } 157 }
158 158
159 GURL HttpStreamFactory::ApplyHostMappingRules(const GURL& url, 159 GURL HttpStreamFactory::ApplyHostMappingRules(const GURL& url,
160 HostPortPair* endpoint) { 160 HostPortPair* endpoint) {
161 const HostMappingRules* mapping_rules = GetHostMappingRules(); 161 const HostMappingRules* mapping_rules = GetHostMappingRules();
162 if (mapping_rules && mapping_rules->RewriteHost(endpoint)) { 162 if (mapping_rules && mapping_rules->RewriteHost(endpoint)) {
163 url::Replacements<char> replacements; 163 url::Replacements<char> replacements;
164 const std::string port_str = base::UintToString(endpoint->port()); 164 const std::string port_str = base::UintToString(endpoint->port());
165 replacements.SetPort(port_str.c_str(), url::Component(0, port_str.size())); 165 replacements.SetPort(port_str.c_str(), url::Component(0, port_str.size()));
166 replacements.SetHost(endpoint->host().c_str(), 166 replacements.SetHost(endpoint->host().c_str(),
167 url::Component(0, endpoint->host().size())); 167 url::Component(0, endpoint->host().size()));
168 return url.ReplaceComponents(replacements); 168 return url.ReplaceComponents(replacements);
169 } 169 }
170 return url; 170 return url;
171 } 171 }
172 172
173 HttpStreamFactory::HttpStreamFactory() {} 173 HttpStreamFactory::HttpStreamFactory() {}
174 174
175 HostPortPair HttpStreamFactory::RewriteHost(HostPortPair host_port_pair) { 175 HostPortPair HttpStreamFactory::RewriteHost(HostPortPair host_port_pair) {
176 const HostMappingRules* mapping_rules = GetHostMappingRules(); 176 const HostMappingRules* mapping_rules = GetHostMappingRules();
177 if (mapping_rules) 177 if (mapping_rules)
178 mapping_rules->RewriteHost(&host_port_pair); 178 mapping_rules->RewriteHost(&host_port_pair);
179 return host_port_pair; 179 return host_port_pair;
180 } 180 }
181 181
182 } // namespace net 182 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698