| Index: net/http/http_stream_factory_impl.cc
|
| diff --git a/net/http/http_stream_factory_impl.cc b/net/http/http_stream_factory_impl.cc
|
| index 689bcf93c843e2eb9a440bb088d1c04149639d7a..f7ccc7e97c7b81245e5ba7e6f2008150b0f9a2ec 100644
|
| --- a/net/http/http_stream_factory_impl.cc
|
| +++ b/net/http/http_stream_factory_impl.cc
|
| @@ -192,52 +192,58 @@ AlternateProtocolInfo HttpStreamFactoryImpl::GetAlternateProtocolRequestFor(
|
| if (!http_server_properties.HasAlternateProtocol(origin))
|
| return kNoAlternateProtocol;
|
|
|
| - AlternateProtocolInfo alternate =
|
| + AlternateProtocols alternate_protocols =
|
| http_server_properties.GetAlternateProtocol(origin);
|
| - if (alternate.protocol == ALTERNATE_PROTOCOL_BROKEN) {
|
| - HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_BROKEN);
|
| - return kNoAlternateProtocol;
|
| - }
|
| -
|
| - if (!IsAlternateProtocolValid(alternate.protocol)) {
|
| - NOTREACHED();
|
| - return kNoAlternateProtocol;
|
| - }
|
| -
|
| - // Some shared unix systems may have user home directories (like
|
| - // http://foo.com/~mike) which allow users to emit headers. This is a bad
|
| - // idea already, but with Alternate-Protocol, it provides the ability for a
|
| - // single user on a multi-user system to hijack the alternate protocol.
|
| - // These systems also enforce ports <1024 as restricted ports. So don't
|
| - // allow protocol upgrades to user-controllable ports.
|
| - const int kUnrestrictedPort = 1024;
|
| - if (!session_->params().enable_user_alternate_protocol_ports &&
|
| - (alternate.port >= kUnrestrictedPort &&
|
| - origin.port() < kUnrestrictedPort))
|
| - return kNoAlternateProtocol;
|
| -
|
| - origin.set_port(alternate.port);
|
| - if (alternate.protocol >= NPN_SPDY_MINIMUM_VERSION &&
|
| - alternate.protocol <= NPN_SPDY_MAXIMUM_VERSION) {
|
| - if (!HttpStreamFactory::spdy_enabled())
|
| - return kNoAlternateProtocol;
|
| + for (AlternateProtocols::iterator alternate = alternate_protocols.begin();
|
| + alternate != alternate_protocols.end();
|
| + ++alternate) {
|
| + if (alternate->protocol == ALTERNATE_PROTOCOL_BROKEN) {
|
| + HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_BROKEN);
|
| + continue;
|
| + }
|
|
|
| - if (session_->HasSpdyExclusion(origin))
|
| - return kNoAlternateProtocol;
|
| + if (!IsAlternateProtocolValid(alternate->protocol)) {
|
| + NOTREACHED();
|
| + continue;
|
| + }
|
|
|
| - *alternate_url = UpgradeUrlToHttps(original_url, alternate.port);
|
| - } else {
|
| - DCHECK_EQ(QUIC, alternate.protocol);
|
| - if (!session_->params().enable_quic)
|
| - return kNoAlternateProtocol;
|
| -
|
| - // TODO(rch): Figure out how to make QUIC iteract with PAC
|
| - // scripts. By not re-writing the URL, we will query the PAC script
|
| - // for the proxy to use to reach the original URL via TCP. But
|
| - // the alternate request will be going via UDP to a different port.
|
| - *alternate_url = original_url;
|
| + // Some shared unix systems may have user home directories (like
|
| + // http://foo.com/~mike) which allow users to emit headers. This is a bad
|
| + // idea already, but with Alternate-Protocol, it provides the ability for a
|
| + // single user on a multi-user system to hijack the alternate protocol.
|
| + // These systems also enforce ports <1024 as restricted ports. So don't
|
| + // allow protocol upgrades to user-controllable ports.
|
| + const int kUnrestrictedPort = 1024;
|
| + if (!session_->params().enable_user_alternate_protocol_ports &&
|
| + (alternate->port >= kUnrestrictedPort &&
|
| + origin.port() < kUnrestrictedPort))
|
| + continue;
|
| +
|
| + origin.set_port(alternate->port);
|
| + if (alternate->protocol >= NPN_SPDY_MINIMUM_VERSION &&
|
| + alternate->protocol <= NPN_SPDY_MAXIMUM_VERSION) {
|
| + if (!HttpStreamFactory::spdy_enabled())
|
| + continue;
|
| +
|
| + if (session_->HasSpdyExclusion(origin))
|
| + continue;
|
| +
|
| + *alternate_url = UpgradeUrlToHttps(original_url, alternate->port);
|
| + return *alternate;
|
| + } else {
|
| + DCHECK_EQ(QUIC, alternate->protocol);
|
| + if (!session_->params().enable_quic)
|
| + continue;
|
| +
|
| + // TODO(rch): Figure out how to make QUIC iteract with PAC
|
| + // scripts. By not re-writing the URL, we will query the PAC script
|
| + // for the proxy to use to reach the original URL via TCP. But
|
| + // the alternate request will be going via UDP to a different port.
|
| + *alternate_url = original_url;
|
| + return *alternate;
|
| + }
|
| }
|
| - return alternate;
|
| + return kNoAlternateProtocol;
|
| }
|
|
|
| void HttpStreamFactoryImpl::OrphanJob(Job* job, const Request* request) {
|
|
|