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 "net/base/host_mapping_rules.h" | 10 #include "net/base/host_mapping_rules.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return; | 117 return; |
118 } | 118 } |
119 | 119 |
120 http_server_properties->SetAlternateProtocol(host_port, port, protocol); | 120 http_server_properties->SetAlternateProtocol(host_port, port, protocol); |
121 } | 121 } |
122 | 122 |
123 GURL HttpStreamFactory::ApplyHostMappingRules(const GURL& url, | 123 GURL HttpStreamFactory::ApplyHostMappingRules(const GURL& url, |
124 HostPortPair* endpoint) { | 124 HostPortPair* endpoint) { |
125 const HostMappingRules* mapping_rules = GetHostMappingRules(); | 125 const HostMappingRules* mapping_rules = GetHostMappingRules(); |
126 if (mapping_rules && mapping_rules->RewriteHost(endpoint)) { | 126 if (mapping_rules && mapping_rules->RewriteHost(endpoint)) { |
127 url_canon::Replacements<char> replacements; | 127 url::Replacements<char> replacements; |
128 const std::string port_str = base::IntToString(endpoint->port()); | 128 const std::string port_str = base::IntToString(endpoint->port()); |
129 replacements.SetPort(port_str.c_str(), | 129 replacements.SetPort(port_str.c_str(), url::Component(0, port_str.size())); |
130 url_parse::Component(0, port_str.size())); | |
131 replacements.SetHost(endpoint->host().c_str(), | 130 replacements.SetHost(endpoint->host().c_str(), |
132 url_parse::Component(0, endpoint->host().size())); | 131 url::Component(0, endpoint->host().size())); |
133 return url.ReplaceComponents(replacements); | 132 return url.ReplaceComponents(replacements); |
134 } | 133 } |
135 return url; | 134 return url; |
136 } | 135 } |
137 | 136 |
138 // static | 137 // static |
139 void HttpStreamFactory::add_forced_spdy_exclusion(const std::string& value) { | 138 void HttpStreamFactory::add_forced_spdy_exclusion(const std::string& value) { |
140 HostPortPair pair = HostPortPair::FromURL(GURL(value)); | 139 HostPortPair pair = HostPortPair::FromURL(GURL(value)); |
141 if (!forced_spdy_exclusions_) | 140 if (!forced_spdy_exclusions_) |
142 forced_spdy_exclusions_ = new std::list<HostPortPair>(); | 141 forced_spdy_exclusions_ = new std::list<HostPortPair>(); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 continue; | 238 continue; |
240 } | 239 } |
241 SetProtocolEnabled(alternate); | 240 SetProtocolEnabled(alternate); |
242 } | 241 } |
243 } | 242 } |
244 } | 243 } |
245 | 244 |
246 HttpStreamFactory::HttpStreamFactory() {} | 245 HttpStreamFactory::HttpStreamFactory() {} |
247 | 246 |
248 } // namespace net | 247 } // namespace net |
OLD | NEW |