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

Commit ad78422

Browse files
authored
Merge pull request #397 from justcoding121/develop
merge to beta
2 parents a007c1c + fce1aa5 commit ad78422

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

Titanium.Web.Proxy/ProxyServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public void SetAsSystemProxy(ExplicitProxyEndPoint endPoint, ProxyProtocolType p
316316

317317
bool isHttp = (protocolType & ProxyProtocolType.Http) > 0;
318318
bool isHttps = (protocolType & ProxyProtocolType.Https) > 0;
319-
319+
320320
if (isHttps)
321321
{
322322
if (!endPoint.EnableSsl)

Titanium.Web.Proxy/RequestHandler.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,12 @@ private async Task HandleClient(ExplicitProxyEndPoint endPoint, TcpClient tcpCli
9797

9898
await clientStreamWriter.WriteResponseAsync(response);
9999

100-
var clientHelloInfo = await SslTools.PeekClientHello(clientStream);
100+
ClientHelloInfo clientHelloInfo = null;
101+
if (endPoint.EnableSsl)
102+
{
103+
clientHelloInfo = await SslTools.PeekClientHello(clientStream);
104+
}
105+
101106
bool isClientHello = clientHelloInfo != null;
102107
if (isClientHello)
103108
{

Titanium.Web.Proxy/ResponseHandler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ private async Task HandleHttpSessionResponse(SessionEventArgs args)
2828
await args.WebSession.ReceiveResponse();
2929

3030
var response = args.WebSession.Response;
31+
args.ReRequest = false;
3132

3233
//check for windows authentication
3334
if (isWindowsAuthenticationEnabledAndSupported && response.StatusCode == (int)HttpStatusCode.Unauthorized)
3435
{
3536
await Handle401UnAuthorized(args);
3637
}
3738

38-
args.ReRequest = false;
39+
response.OriginalHasBody = response.HasBody;
3940

4041
//if user requested call back then do it
4142
if (!response.Locked)

Titanium.Web.Proxy/WinAuthHandler.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,8 @@ internal async Task Handle401UnAuthorized(SessionEventArgs args)
130130
//Should we cache all Set-Cokiee headers from server during auth process
131131
//and send it to client after auth?
132132

133-
//clear current server response
134-
await args.ClearResponse();
135-
136-
//request again with updated authorization header
137-
//and server cookies
138-
await HandleHttpSessionRequestInternal(args.WebSession.ServerConnection, args);
133+
// Let ResponseHandler send the updated request
134+
args.ReRequest = true;
139135
}
140136
}
141137
}

0 commit comments

Comments
 (0)