From 4b90041c911c14c5bc69b0544a608ca6ba082042 Mon Sep 17 00:00:00 2001 From: RR55 Date: Mon, 9 Aug 2021 18:32:20 +0200 Subject: [PATCH] Added host header to proxy connect request in order to be compliant with HTTP 1.1 --- .../Network/TcpConnection/TcpConnectionFactory.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Titanium.Web.Proxy/Network/TcpConnection/TcpConnectionFactory.cs b/src/Titanium.Web.Proxy/Network/TcpConnection/TcpConnectionFactory.cs index 7d7f5f30a..918368f47 100644 --- a/src/Titanium.Web.Proxy/Network/TcpConnection/TcpConnectionFactory.cs +++ b/src/Titanium.Web.Proxy/Network/TcpConnection/TcpConnectionFactory.cs @@ -517,15 +517,17 @@ internal Task GetServerConnection(ProxyServer proxyServer, if (externalProxy != null && externalProxy.ProxyType == ExternalProxyType.Http && (isConnect || isHttps)) { - var authority = $"{remoteHostName}:{remotePort}".GetByteString(); - var connectRequest = new ConnectRequest(authority) + var authority = $"{remoteHostName}:{remotePort}"; + var authorityBytes = authority.GetByteString(); + var connectRequest = new ConnectRequest(authorityBytes) { IsHttps = isHttps, - RequestUriString8 = authority, + RequestUriString8 = authorityBytes, HttpVersion = httpVersion }; connectRequest.Headers.AddHeader(KnownHeaders.Connection, KnownHeaders.ConnectionKeepAlive); + connectRequest.Headers.AddHeader(KnownHeaders.Host, authority); if (!string.IsNullOrEmpty(externalProxy.UserName) && externalProxy.Password != null) {