| 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 235122d2e834ae363f77203bc88277c5ad2c96e5..819acee946d1a53bec24a28bd666639a0b642b96 100644
|
| --- a/net/http/http_stream_factory_impl.cc
|
| +++ b/net/http/http_stream_factory_impl.cc
|
| @@ -185,54 +185,53 @@ AlternateProtocolInfo HttpStreamFactoryImpl::GetAlternateProtocolRequestFor(
|
| HostPortPair origin = HostPortPair::FromURL(original_url);
|
| HttpServerProperties& http_server_properties =
|
| *session_->http_server_properties();
|
| - const AlternateProtocolInfo alternate =
|
| - http_server_properties.GetAlternateProtocol(origin);
|
| -
|
| - if (alternate.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
|
| - return kNoAlternateProtocol;
|
| - 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))
|
| + AlternateProtocols alternate_protocols =
|
| + http_server_properties.GetAlternateProtocols(origin);
|
| + if (alternate_protocols.empty())
|
| return kNoAlternateProtocol;
|
| + for (const AlternateProtocol& alternate : alternate_protocols) {
|
| + if (alternate.is_broken) {
|
| + HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_BROKEN);
|
| + continue;
|
| + }
|
|
|
| - origin.set_port(alternate.port);
|
| - if (alternate.protocol >= NPN_SPDY_MINIMUM_VERSION &&
|
| - alternate.protocol <= NPN_SPDY_MAXIMUM_VERSION) {
|
| - if (!HttpStreamFactory::spdy_enabled())
|
| - return kNoAlternateProtocol;
|
| -
|
| - if (session_->HasSpdyExclusion(origin))
|
| - return kNoAlternateProtocol;
|
| -
|
| - *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) {
|
|
|