| 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_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 const HttpServerProperties& http_server_properties = | 200 const HttpServerProperties& http_server_properties = |
| 201 *session_->http_server_properties(); | 201 *session_->http_server_properties(); |
| 202 if (!http_server_properties.HasAlternateProtocol(origin)) | 202 if (!http_server_properties.HasAlternateProtocol(origin)) |
| 203 return kNoAlternateProtocol; | 203 return kNoAlternateProtocol; |
| 204 | 204 |
| 205 PortAlternateProtocolPair alternate = | 205 PortAlternateProtocolPair alternate = |
| 206 http_server_properties.GetAlternateProtocol(origin); | 206 http_server_properties.GetAlternateProtocol(origin); |
| 207 if (alternate.protocol == ALTERNATE_PROTOCOL_BROKEN) | 207 if (alternate.protocol == ALTERNATE_PROTOCOL_BROKEN) |
| 208 return kNoAlternateProtocol; | 208 return kNoAlternateProtocol; |
| 209 | 209 |
| 210 DCHECK_LE(NPN_SPDY_1, alternate.protocol); | 210 if (!IsAlternateProtocolValid(alternate.protocol)) { |
| 211 DCHECK_GT(NUM_ALTERNATE_PROTOCOLS, alternate.protocol); | 211 NOTREACHED(); |
| 212 | |
| 213 if (alternate.protocol < NPN_SPDY_2) | |
| 214 return kNoAlternateProtocol; | 212 return kNoAlternateProtocol; |
| 213 } |
| 215 | 214 |
| 216 // Some shared unix systems may have user home directories (like | 215 // Some shared unix systems may have user home directories (like |
| 217 // http://foo.com/~mike) which allow users to emit headers. This is a bad | 216 // http://foo.com/~mike) which allow users to emit headers. This is a bad |
| 218 // idea already, but with Alternate-Protocol, it provides the ability for a | 217 // idea already, but with Alternate-Protocol, it provides the ability for a |
| 219 // single user on a multi-user system to hijack the alternate protocol. | 218 // single user on a multi-user system to hijack the alternate protocol. |
| 220 // These systems also enforce ports <1024 as restricted ports. So don't | 219 // These systems also enforce ports <1024 as restricted ports. So don't |
| 221 // allow protocol upgrades to user-controllable ports. | 220 // allow protocol upgrades to user-controllable ports. |
| 222 const int kUnrestrictedPort = 1024; | 221 const int kUnrestrictedPort = 1024; |
| 223 if (!session_->params().enable_user_alternate_protocol_ports && | 222 if (!session_->params().enable_user_alternate_protocol_ports && |
| 224 (alternate.port >= kUnrestrictedPort && | 223 (alternate.port >= kUnrestrictedPort && |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 it != requests_to_fail.end(); ++it) { | 351 it != requests_to_fail.end(); ++it) { |
| 353 Request* request = *it; | 352 Request* request = *it; |
| 354 if (request == request_map_[job]) { | 353 if (request == request_map_[job]) { |
| 355 continue; | 354 continue; |
| 356 } | 355 } |
| 357 request->OnStreamFailed(NULL, status, used_ssl_config); | 356 request->OnStreamFailed(NULL, status, used_ssl_config); |
| 358 } | 357 } |
| 359 } | 358 } |
| 360 | 359 |
| 361 } // namespace net | 360 } // namespace net |
| OLD | NEW |