Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit 8ce56f7

Browse files
RuridoRR55
andauthored
Added host header to proxy connect request in order to be compliant with HTTP 1.1 (#877)
Co-authored-by: RR55 <git@rurido.de>
1 parent 2c11272 commit 8ce56f7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Titanium.Web.Proxy/Network/TcpConnection/TcpConnectionFactory.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,15 +520,17 @@ internal Task<TcpServerConnection> GetServerConnection(ProxyServer proxyServer,
520520

521521
if (externalProxy != null && externalProxy.ProxyType == ExternalProxyType.Http && (isConnect || isHttps))
522522
{
523-
var authority = $"{remoteHostName}:{remotePort}".GetByteString();
524-
var connectRequest = new ConnectRequest(authority)
523+
var authority = $"{remoteHostName}:{remotePort}";
524+
var authorityBytes = authority.GetByteString();
525+
var connectRequest = new ConnectRequest(authorityBytes)
525526
{
526527
IsHttps = isHttps,
527-
RequestUriString8 = authority,
528+
RequestUriString8 = authorityBytes,
528529
HttpVersion = httpVersion
529530
};
530531

531532
connectRequest.Headers.AddHeader(KnownHeaders.Connection, KnownHeaders.ConnectionKeepAlive);
533+
connectRequest.Headers.AddHeader(KnownHeaders.Host, authority);
532534

533535
if (!string.IsNullOrEmpty(externalProxy.UserName) && externalProxy.Password != null)
534536
{

0 commit comments

Comments
 (0)