| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
| 6 | 6 |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "net/base/net_log.h" | 10 #include "net/base/net_log.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 return false; | 149 return false; |
| 150 | 150 |
| 151 PortAlternateProtocolPair alternate = | 151 PortAlternateProtocolPair alternate = |
| 152 http_server_properties.GetAlternateProtocol(origin); | 152 http_server_properties.GetAlternateProtocol(origin); |
| 153 if (alternate.protocol == ALTERNATE_PROTOCOL_BROKEN) | 153 if (alternate.protocol == ALTERNATE_PROTOCOL_BROKEN) |
| 154 return false; | 154 return false; |
| 155 | 155 |
| 156 DCHECK_LE(NPN_SPDY_1, alternate.protocol); | 156 DCHECK_LE(NPN_SPDY_1, alternate.protocol); |
| 157 DCHECK_GT(NUM_ALTERNATE_PROTOCOLS, alternate.protocol); | 157 DCHECK_GT(NUM_ALTERNATE_PROTOCOLS, alternate.protocol); |
| 158 | 158 |
| 159 if (alternate.protocol != NPN_SPDY_2) | 159 if (alternate.protocol < NPN_SPDY_2) |
| 160 return false; | 160 return false; |
| 161 | 161 |
| 162 // Some shared unix systems may have user home directories (like | 162 // Some shared unix systems may have user home directories (like |
| 163 // http://foo.com/~mike) which allow users to emit headers. This is a bad | 163 // http://foo.com/~mike) which allow users to emit headers. This is a bad |
| 164 // idea already, but with Alternate-Protocol, it provides the ability for a | 164 // idea already, but with Alternate-Protocol, it provides the ability for a |
| 165 // single user on a multi-user system to hijack the alternate protocol. | 165 // single user on a multi-user system to hijack the alternate protocol. |
| 166 // These systems also enforce ports <1024 as restricted ports. So don't | 166 // These systems also enforce ports <1024 as restricted ports. So don't |
| 167 // allow protocol upgrades to user-controllable ports. | 167 // allow protocol upgrades to user-controllable ports. |
| 168 const int kUnrestrictedPort = 1024; | 168 const int kUnrestrictedPort = 1024; |
| 169 if (alternate.port >= kUnrestrictedPort && origin.port() < kUnrestrictedPort) | 169 if (alternate.port >= kUnrestrictedPort && origin.port() < kUnrestrictedPort) |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 false, // not using_spdy | 244 false, // not using_spdy |
| 245 stream->net_log()); | 245 stream->net_log()); |
| 246 request->OnStreamReady(NULL, | 246 request->OnStreamReady(NULL, |
| 247 stream->used_ssl_config(), | 247 stream->used_ssl_config(), |
| 248 stream->used_proxy_info(), | 248 stream->used_proxy_info(), |
| 249 stream); | 249 stream); |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace net | 253 } // namespace net |
| OLD | NEW |