OLD | NEW |
1 // Copyright (c) 2011 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/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 "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 #include "net/base/host_mapping_rules.h" | 11 #include "net/base/host_mapping_rules.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 if (!base::StringToInt(port_protocol_vector[0], &port) || | 75 if (!base::StringToInt(port_protocol_vector[0], &port) || |
76 port <= 0 || port >= 1 << 16) { | 76 port <= 0 || port >= 1 << 16) { |
77 DLOG(WARNING) << kAlternateProtocolHeader | 77 DLOG(WARNING) << kAlternateProtocolHeader |
78 << " header has unrecognizable port: " | 78 << " header has unrecognizable port: " |
79 << port_protocol_vector[0]; | 79 << port_protocol_vector[0]; |
80 return; | 80 return; |
81 } | 81 } |
82 | 82 |
83 AlternateProtocol protocol = ALTERNATE_PROTOCOL_BROKEN; | 83 AlternateProtocol protocol = ALTERNATE_PROTOCOL_BROKEN; |
84 // We skip NPN_SPDY_1 here, because we've rolled the protocol version to 2. | 84 // We skip NPN_SPDY_1 here, because we've rolled the protocol version to 2. |
85 for (int i = NPN_SPDY_2; i < NUM_ALTERNATE_PROTOCOLS; ++i) { | 85 // TODO(rtenneti): add support for SPDY/2.1 (use next_protos_ to determine the |
| 86 // protocol). |
| 87 for (int i = NPN_SPDY_2; i <= NPN_SPDY_2; ++i) { |
86 if (port_protocol_vector[1] == kAlternateProtocolStrings[i]) | 88 if (port_protocol_vector[1] == kAlternateProtocolStrings[i]) |
87 protocol = static_cast<AlternateProtocol>(i); | 89 protocol = static_cast<AlternateProtocol>(i); |
88 } | 90 } |
89 | 91 |
90 if (protocol == ALTERNATE_PROTOCOL_BROKEN) { | 92 if (protocol == ALTERNATE_PROTOCOL_BROKEN) { |
91 // Currently, we only recognize the npn-spdy protocol. | 93 // Currently, we only recognize the npn-spdy protocol. |
92 DLOG(WARNING) << kAlternateProtocolHeader | 94 DLOG(WARNING) << kAlternateProtocolHeader |
93 << " header has unrecognized protocol: " | 95 << " header has unrecognized protocol: " |
94 << port_protocol_vector[1]; | 96 << port_protocol_vector[1]; |
95 return; | 97 return; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 HttpStreamFactory::HttpStreamFactory() {} | 157 HttpStreamFactory::HttpStreamFactory() {} |
156 | 158 |
157 // static | 159 // static |
158 const HostMappingRules& HttpStreamFactory::host_mapping_rules() { | 160 const HostMappingRules& HttpStreamFactory::host_mapping_rules() { |
159 if (!host_mapping_rules_) | 161 if (!host_mapping_rules_) |
160 host_mapping_rules_ = new HostMappingRules; | 162 host_mapping_rules_ = new HostMappingRules; |
161 return *host_mapping_rules_; | 163 return *host_mapping_rules_; |
162 } | 164 } |
163 | 165 |
164 } // namespace net | 166 } // namespace net |
OLD | NEW |