From 1eac86d6261415286b427c0ee7e0ecd15f1ae6c3 Mon Sep 17 00:00:00 2001 From: tbansal Date: Tue, 8 Sep 2015 12:09:14 -0700 Subject: [PATCH] Bypass QUIC proxy on ERR_MSG_TOO_BIG BUG=526774 Review URL: https://codereview.chromium.org/1306813007 Cr-Commit-Position: refs/heads/master@{#347761} --- net/http/http_stream_factory_impl_job.cc | 10 +++++++--- net/http/http_stream_factory_impl_unittest.cc | 13 ++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc index b5fbb896e525..daa5e0572bce 100644 --- a/net/http/http_stream_factory_impl_job.cc +++ b/net/http/http_stream_factory_impl_job.cc @@ -977,7 +977,7 @@ int HttpStreamFactoryImpl::Job::DoInitConnectionComplete(int result) { if (proxy_info_.is_quic() && using_quic_) { if (result == ERR_QUIC_PROTOCOL_ERROR || - result == ERR_QUIC_HANDSHAKE_FAILED) { + result == ERR_QUIC_HANDSHAKE_FAILED || result == ERR_MSG_TOO_BIG) { using_quic_ = false; return ReconsiderProxyAfterError(result); } @@ -1386,6 +1386,7 @@ int HttpStreamFactoryImpl::Job::ReconsiderProxyAfterError(int error) { // captive portal). case ERR_QUIC_PROTOCOL_ERROR: case ERR_QUIC_HANDSHAKE_FAILED: + case ERR_MSG_TOO_BIG: case ERR_SSL_PROTOCOL_ERROR: break; case ERR_SOCKS_CONNECTION_HOST_UNREACHABLE: @@ -1402,9 +1403,12 @@ int HttpStreamFactoryImpl::Job::ReconsiderProxyAfterError(int error) { return error; } - if (request_info_.load_flags & LOAD_BYPASS_PROXY) { + // Do not bypass non-QUIC proxy on ERR_MSG_TOO_BIG. + if (!proxy_info_.is_quic() && error == ERR_MSG_TOO_BIG) + return error; + + if (request_info_.load_flags & LOAD_BYPASS_PROXY) return error; - } if (proxy_info_.is_https() && proxy_ssl_config_.send_client_cert) { session_->ssl_client_auth_cache()->Remove( diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc index 11cf98d1bd0c..9bf70e04d98d 100644 --- a/net/http/http_stream_factory_impl_unittest.cc +++ b/net/http/http_stream_factory_impl_unittest.cc @@ -614,10 +614,9 @@ TEST_P(HttpStreamFactoryTest, JobNotifiesProxy) { } TEST_P(HttpStreamFactoryTest, UnreachableQuicProxyMarkedAsBad) { - for (int i = 1; i <= 2; i++) { - int mock_error = - i == 1 ? ERR_QUIC_PROTOCOL_ERROR : ERR_QUIC_HANDSHAKE_FAILED; - + const int mock_error[] = {ERR_QUIC_PROTOCOL_ERROR, ERR_QUIC_HANDSHAKE_FAILED, + ERR_MSG_TOO_BIG}; + for (size_t i = 0; i < arraysize(mock_error); ++i) { scoped_ptr proxy_service; proxy_service.reset( ProxyService::CreateFixedFromPacResult("QUIC bad:99; DIRECT")); @@ -643,7 +642,7 @@ TEST_P(HttpStreamFactoryTest, UnreachableQuicProxyMarkedAsBad) { session->quic_stream_factory()->set_require_confirmation(false); StaticSocketDataProvider socket_data1; - socket_data1.set_connect_data(MockConnect(ASYNC, mock_error)); + socket_data1.set_connect_data(MockConnect(ASYNC, mock_error[i])); socket_factory.AddSocketDataProvider(&socket_data1); // Second connection attempt succeeds. @@ -668,11 +667,11 @@ TEST_P(HttpStreamFactoryTest, UnreachableQuicProxyMarkedAsBad) { // The proxy that failed should now be known to the proxy_service as bad. const ProxyRetryInfoMap& retry_info = session->proxy_service()->proxy_retry_info(); - EXPECT_EQ(1u, retry_info.size()) << i; + EXPECT_EQ(1u, retry_info.size()) << mock_error[i]; EXPECT_TRUE(waiter.used_proxy_info().is_direct()); ProxyRetryInfoMap::const_iterator iter = retry_info.find("quic://bad:99"); - EXPECT_TRUE(iter != retry_info.end()) << i; + EXPECT_TRUE(iter != retry_info.end()) << mock_error[i]; } } -- 2.11.4.GIT