| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 bool HttpStreamFactory::IsTLSIntolerantServer(const GURL& url) { | 71 bool HttpStreamFactory::IsTLSIntolerantServer(const GURL& url) { |
| 72 return ContainsKey(tls_intolerant_servers_, GetHostAndPort(url)); | 72 return ContainsKey(tls_intolerant_servers_, GetHostAndPort(url)); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void HttpStreamFactory::ProcessAlternateProtocol( | 75 void HttpStreamFactory::ProcessAlternateProtocol( |
| 76 HttpAlternateProtocols* alternate_protocols, | 76 HttpAlternateProtocols* alternate_protocols, |
| 77 const std::string& alternate_protocol_str, | 77 const std::string& alternate_protocol_str, |
| 78 const HostPortPair& http_host_port_pair) { | 78 const HostPortPair& http_host_port_pair) { |
| 79 std::vector<std::string> port_protocol_vector; | 79 std::vector<std::string> port_protocol_vector; |
| 80 SplitString(alternate_protocol_str, ':', &port_protocol_vector); | 80 base::SplitString(alternate_protocol_str, ':', &port_protocol_vector); |
| 81 if (port_protocol_vector.size() != 2) { | 81 if (port_protocol_vector.size() != 2) { |
| 82 DLOG(WARNING) << HttpAlternateProtocols::kHeader | 82 DLOG(WARNING) << HttpAlternateProtocols::kHeader |
| 83 << " header has too many tokens: " | 83 << " header has too many tokens: " |
| 84 << alternate_protocol_str; | 84 << alternate_protocol_str; |
| 85 return; | 85 return; |
| 86 } | 86 } |
| 87 | 87 |
| 88 int port; | 88 int port; |
| 89 if (!base::StringToInt(port_protocol_vector[0], &port) || | 89 if (!base::StringToInt(port_protocol_vector[0], &port) || |
| 90 port <= 0 || port >= 1 << 16) { | 90 port <= 0 || port >= 1 << 16) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 replacements.SetPort(port_str.c_str(), | 133 replacements.SetPort(port_str.c_str(), |
| 134 url_parse::Component(0, port_str.size())); | 134 url_parse::Component(0, port_str.size())); |
| 135 replacements.SetHost(endpoint->host().c_str(), | 135 replacements.SetHost(endpoint->host().c_str(), |
| 136 url_parse::Component(0, endpoint->host().size())); | 136 url_parse::Component(0, endpoint->host().size())); |
| 137 return url.ReplaceComponents(replacements); | 137 return url.ReplaceComponents(replacements); |
| 138 } | 138 } |
| 139 return url; | 139 return url; |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace net | 142 } // namespace net |
| OLD | NEW |