| 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 8b12dba4a0e9f121b7d708950f995d19bddb8831..fac6da368ba5cd350b9e17ff9862d2a4bde2f027 100644
|
| --- a/net/http/http_stream_factory_impl.cc
|
| +++ b/net/http/http_stream_factory_impl.cc
|
| @@ -191,52 +191,57 @@ AlternateProtocolInfo HttpStreamFactoryImpl::GetAlternateProtocolRequestFor(
|
| if (!http_server_properties.HasAlternateProtocol(origin))
|
| return kNoAlternateProtocol;
|
|
|
| - AlternateProtocolInfo alternate =
|
| - http_server_properties.GetAlternateProtocol(origin);
|
| - if (alternate.is_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;
|
| + AlternateProtocols alternate_protocols =
|
| + http_server_properties.GetAlternateProtocols(origin);
|
| + for (AlternateProtocols::iterator alternate = alternate_protocols.begin();
|
| + alternate != alternate_protocols.end(); ++alternate) {
|
| + if (alternate->is_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) {
|
|
|