| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 // single user on a multi-user system to hijack the alternate protocol. | 219 // 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 | 220 // These systems also enforce ports <1024 as restricted ports. So don't |
| 221 // allow protocol upgrades to user-controllable ports. | 221 // allow protocol upgrades to user-controllable ports. |
| 222 const int kUnrestrictedPort = 1024; | 222 const int kUnrestrictedPort = 1024; |
| 223 if (!session_->params().enable_user_alternate_protocol_ports && | 223 if (!session_->params().enable_user_alternate_protocol_ports && |
| 224 (alternate.port >= kUnrestrictedPort && | 224 (alternate.port >= kUnrestrictedPort && |
| 225 origin.port() < kUnrestrictedPort)) | 225 origin.port() < kUnrestrictedPort)) |
| 226 return kNoAlternateProtocol; | 226 return kNoAlternateProtocol; |
| 227 | 227 |
| 228 origin.set_port(alternate.port); | 228 origin.set_port(alternate.port); |
| 229 if (alternate.protocol >= NPN_SPDY_2 && alternate.protocol <= NPN_SPDY_3) { | 229 if (alternate.protocol >= NPN_SPDY_MINIMUM_VERSION && |
| 230 alternate.protocol <= NPN_SPDY_MAXIMUM_VERSION) { |
| 230 if (!spdy_enabled()) | 231 if (!spdy_enabled()) |
| 231 return kNoAlternateProtocol; | 232 return kNoAlternateProtocol; |
| 232 | 233 |
| 233 if (HttpStreamFactory::HasSpdyExclusion(origin)) | 234 if (HttpStreamFactory::HasSpdyExclusion(origin)) |
| 234 return kNoAlternateProtocol; | 235 return kNoAlternateProtocol; |
| 235 | 236 |
| 236 *alternate_url = UpgradeUrlToHttps(original_url, alternate.port); | 237 *alternate_url = UpgradeUrlToHttps(original_url, alternate.port); |
| 237 } else { | 238 } else { |
| 238 DCHECK_EQ(QUIC, alternate.protocol); | 239 DCHECK_EQ(QUIC, alternate.protocol); |
| 239 if (!session_->params().enable_quic || | 240 if (!session_->params().enable_quic || |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 it != requests_to_fail.end(); ++it) { | 349 it != requests_to_fail.end(); ++it) { |
| 349 Request* request = *it; | 350 Request* request = *it; |
| 350 if (request == request_map_[job]) { | 351 if (request == request_map_[job]) { |
| 351 continue; | 352 continue; |
| 352 } | 353 } |
| 353 request->OnStreamFailed(NULL, status, used_ssl_config); | 354 request->OnStreamFailed(NULL, status, used_ssl_config); |
| 354 } | 355 } |
| 355 } | 356 } |
| 356 | 357 |
| 357 } // namespace net | 358 } // namespace net |
| OLD | NEW |