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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 } | 79 } |
| 80 | 80 |
| 81 if (protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) | 81 if (protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) |
| 82 return; | 82 return; |
| 83 | 83 |
| 84 HostPortPair host_port(http_host_port_pair); | 84 HostPortPair host_port(http_host_port_pair); |
| 85 const HostMappingRules* mapping_rules = GetHostMappingRules(); | 85 const HostMappingRules* mapping_rules = GetHostMappingRules(); |
| 86 if (mapping_rules) | 86 if (mapping_rules) |
| 87 mapping_rules->RewriteHost(&host_port); | 87 mapping_rules->RewriteHost(&host_port); |
| 88 | 88 |
| 89 http_server_properties->SetAlternateProtocol( | 89 http_server_properties->SetAlternativeService( |
| 90 host_port, static_cast<uint16>(port), protocol, probability); | 90 host_port, |
| 91 AlternativeService(protocol, host_port.host(), static_cast<uint16>(port)), | |
|
Ryan Hamilton
2015/03/18 22:55:43
Instead of host_port.host(), this should be "".
Bence
2015/03/19 12:45:39
Oops, sorry.
Done.
| |
| 92 probability); | |
| 91 } | 93 } |
| 92 | 94 |
| 93 GURL HttpStreamFactory::ApplyHostMappingRules(const GURL& url, | 95 GURL HttpStreamFactory::ApplyHostMappingRules(const GURL& url, |
| 94 HostPortPair* endpoint) { | 96 HostPortPair* endpoint) { |
| 95 const HostMappingRules* mapping_rules = GetHostMappingRules(); | 97 const HostMappingRules* mapping_rules = GetHostMappingRules(); |
| 96 if (mapping_rules && mapping_rules->RewriteHost(endpoint)) { | 98 if (mapping_rules && mapping_rules->RewriteHost(endpoint)) { |
| 97 url::Replacements<char> replacements; | 99 url::Replacements<char> replacements; |
| 98 const std::string port_str = base::IntToString(endpoint->port()); | 100 const std::string port_str = base::IntToString(endpoint->port()); |
| 99 replacements.SetPort(port_str.c_str(), url::Component(0, port_str.size())); | 101 replacements.SetPort(port_str.c_str(), url::Component(0, port_str.size())); |
| 100 replacements.SetHost(endpoint->host().c_str(), | 102 replacements.SetHost(endpoint->host().c_str(), |
| 101 url::Component(0, endpoint->host().size())); | 103 url::Component(0, endpoint->host().size())); |
| 102 return url.ReplaceComponents(replacements); | 104 return url.ReplaceComponents(replacements); |
| 103 } | 105 } |
| 104 return url; | 106 return url; |
| 105 } | 107 } |
| 106 | 108 |
| 107 HttpStreamFactory::HttpStreamFactory() {} | 109 HttpStreamFactory::HttpStreamFactory() {} |
| 108 | 110 |
| 109 } // namespace net | 111 } // namespace net |
| OLD | NEW |