From 411f0e042c4a19f9527a20a8da784525ae08ce83 Mon Sep 17 00:00:00 2001 From: klzgrad Date: Fri, 2 Oct 2020 13:07:00 +0800 Subject: [PATCH] Enable QUIC support --- src/net/quic/quic_proxy_client_socket.cc | 11 +++++++---- src/net/tools/naive/naive_proxy_bin.cc | 6 ++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/net/quic/quic_proxy_client_socket.cc b/src/net/quic/quic_proxy_client_socket.cc index ffbcfba395..52abbd619e 100644 --- a/src/net/quic/quic_proxy_client_socket.cc +++ b/src/net/quic/quic_proxy_client_socket.cc @@ -371,7 +371,8 @@ int QuicProxyClientSocket::DoSendRequest() { &proxy_delegate_headers); if (proxy_delegate_headers.HasHeader("fastopen")) { proxy_delegate_headers.RemoveHeader("fastopen"); - use_fastopen_ = true; + // TODO(klzgrad): look into why Fast Open does not work. + // use_fastopen_ = true; } request_.extra_headers.MergeFrom(proxy_delegate_headers); } @@ -465,9 +466,11 @@ int QuicProxyClientSocket::DoReadReplyComplete(int result) { } void QuicProxyClientSocket::OnReadResponseHeadersComplete(int result) { - if (use_fastopen_ && read_headers_pending_ && - next_state_ == STATE_CONNECT_COMPLETE) { - next_state_ = STATE_READ_REPLY_COMPLETE; + if (use_fastopen_ && read_headers_pending_) { + if (next_state_ == STATE_DISCONNECTED) + return; + if (next_state_ == STATE_CONNECT_COMPLETE) + next_state_ = STATE_READ_REPLY_COMPLETE; } // Convert the now-populated spdy::SpdyHeaderBlock to HttpResponseInfo diff --git a/src/net/tools/naive/naive_proxy_bin.cc b/src/net/tools/naive/naive_proxy_bin.cc index 3cbd70d38f..4ba08712dd 100644 --- a/src/net/tools/naive/naive_proxy_bin.cc +++ b/src/net/tools/naive/naive_proxy_bin.cc @@ -56,6 +56,7 @@ #include "net/socket/tcp_server_socket.h" #include "net/socket/udp_server_socket.h" #include "net/ssl/ssl_key_logger_impl.h" +#include "net/third_party/quiche/src/quic/core/quic_versions.h" #include "net/tools/naive/naive_protocol.h" #include "net/tools/naive/naive_proxy.h" #include "net/tools/naive/naive_proxy_delegate.h" @@ -436,6 +437,11 @@ std::unique_ptr BuildURLRequestContext( std::string proxy_url = params.proxy_url; if (proxy_url.compare(0, 7, "quic://") == 0) { proxy_url.replace(0, 4, "https"); + auto* quic = context->quic_context()->params(); + quic->supported_versions.assign(quic::SupportedVersions().begin(), + quic::SupportedVersions().end()); + quic->origins_to_force_quic_on.insert( + net::HostPortPair::FromURL(GURL(proxy_url))); } GURL auth_origin(proxy_url); AuthCredentials credentials(params.proxy_user, params.proxy_pass);