Chromium Code Reviews| 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/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 Loading... | |
| 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 |
| OLD | NEW |