From 1973ef3c6f7a0617b26399b6b859b68acebaa6c5 Mon Sep 17 00:00:00 2001 From: klzgrad Date: Wed, 4 May 2022 01:45:17 +0800 Subject: [PATCH] net: Allow overriding CONNECT authority with header The -connect-authority header overrides the CONNECT authority field. The Cronet bidirectional_stream API does not have a way to pass in this field to support tunnels, so it has to be smuggled in via a header. --- src/net/spdy/spdy_http_utils.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/net/spdy/spdy_http_utils.cc b/src/net/spdy/spdy_http_utils.cc index 147d9fc85c..81d131df8f 100644 --- a/src/net/spdy/spdy_http_utils.cc +++ b/src/net/spdy/spdy_http_utils.cc @@ -111,6 +111,10 @@ void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info, HttpRequestHeaders::Iterator it(request_headers); while (it.GetNext()) { std::string name = base::ToLowerASCII(it.name()); + if (info.method == "CONNECT" && name == "-connect-authority") { + (*headers)[spdy::kHttp2AuthorityHeader] = it.value(); + continue; + } if (name.empty() || name[0] == ':' || name == "connection" || name == "proxy-connection" || name == "transfer-encoding" || name == "host") {