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

Commit

Permalink
Added host header to proxy connect request in order to be compliant w…
Browse files Browse the repository at this point in the history
…ith HTTP 1.1 (#877)

Co-authored-by: RR55 <[email protected]>
  • Loading branch information
Rurido and RR55 authored Aug 16, 2021
1 parent 2c11272 commit 8ce56f7
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,15 +520,17 @@ internal Task<TcpServerConnection> 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)
{
Expand Down

0 comments on commit 8ce56f7

Please sign in to comment.