Enable QUIC support

This commit is contained in:
klzgrad 2020-10-02 13:07:00 +08:00
parent 55e0f463be
commit 411f0e042c
2 changed files with 13 additions and 4 deletions

View File

@ -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

View File

@ -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<URLRequestContext> 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);