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 21 matching lines...) Expand all Loading... |
32 const base::WeakPtr<HttpServerProperties>& http_server_properties, | 32 const base::WeakPtr<HttpServerProperties>& http_server_properties, |
33 const std::vector<std::string>& alternate_protocol_values, | 33 const std::vector<std::string>& alternate_protocol_values, |
34 const HostPortPair& http_host_port_pair, | 34 const HostPortPair& http_host_port_pair, |
35 const HttpNetworkSession& session) { | 35 const HttpNetworkSession& session) { |
36 AlternateProtocol protocol = UNINITIALIZED_ALTERNATE_PROTOCOL; | 36 AlternateProtocol protocol = UNINITIALIZED_ALTERNATE_PROTOCOL; |
37 int port = 0; | 37 int port = 0; |
38 double probability = 1; | 38 double probability = 1; |
39 bool is_valid = true; | 39 bool is_valid = true; |
40 for (size_t i = 0; i < alternate_protocol_values.size(); ++i) { | 40 for (size_t i = 0; i < alternate_protocol_values.size(); ++i) { |
41 const std::string& alternate_protocol_str = alternate_protocol_values[i]; | 41 const std::string& alternate_protocol_str = alternate_protocol_values[i]; |
42 if (StartsWithASCII(alternate_protocol_str, "p=", true)) { | 42 if (base::StartsWithASCII(alternate_protocol_str, "p=", true)) { |
43 if (!base::StringToDouble(alternate_protocol_str.substr(2), | 43 if (!base::StringToDouble(alternate_protocol_str.substr(2), |
44 &probability) || | 44 &probability) || |
45 probability < 0 || probability > 1) { | 45 probability < 0 || probability > 1) { |
46 DVLOG(1) << kAlternateProtocolHeader | 46 DVLOG(1) << kAlternateProtocolHeader |
47 << " header has unrecognizable probability: " | 47 << " header has unrecognizable probability: " |
48 << alternate_protocol_values[i]; | 48 << alternate_protocol_values[i]; |
49 is_valid = false; | 49 is_valid = false; |
50 break; | 50 break; |
51 } | 51 } |
52 continue; | 52 continue; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 replacements.SetHost(endpoint->host().c_str(), | 108 replacements.SetHost(endpoint->host().c_str(), |
109 url::Component(0, endpoint->host().size())); | 109 url::Component(0, endpoint->host().size())); |
110 return url.ReplaceComponents(replacements); | 110 return url.ReplaceComponents(replacements); |
111 } | 111 } |
112 return url; | 112 return url; |
113 } | 113 } |
114 | 114 |
115 HttpStreamFactory::HttpStreamFactory() {} | 115 HttpStreamFactory::HttpStreamFactory() {} |
116 | 116 |
117 } // namespace net | 117 } // namespace net |
OLD | NEW |