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

Commit e1cd5fc

Browse files
committed
minor fixes
1 parent 4e164eb commit e1cd5fc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Titanium.Web.Proxy/Network/TcpConnectionManager.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ internal static async Task<TcpConnection> GetClient(SessionEventArgs sessionArgs
6868
x.IsSecure == isSecure && x.TcpClient.Connected && x.Version.Equals(version)).Count() < 2)
6969
{
7070
var task = CreateClient(sessionArgs, hostname, port, isSecure, version)
71-
.ContinueWith(x => ReleaseClient(x.Result));
71+
.ContinueWith(x => { if (x.Status == TaskStatus.RanToCompletion) ReleaseClient(x.Result); });
7272
}
7373

7474
return cached;

Titanium.Web.Proxy/ResponseHandler.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ public static async Task HandleHttpSessionResponse(SessionEventArgs args)
6767
{
6868
args.WebSession.Response.ResponseBody = await GetCompressedResponseBody(contentEncoding, args.WebSession.Response.ResponseBody).ConfigureAwait(false);
6969

70-
if (isChunked==false)
71-
args.WebSession.Response.ContentLength = args.WebSession.Response.ResponseBody.Length;
70+
if (isChunked == false)
71+
args.WebSession.Response.ContentLength = args.WebSession.Response.ResponseBody.Length;
72+
else
73+
args.WebSession.Response.ContentLength = -1;
7274
}
7375

7476
await WriteResponseHeaders(args.Client.ClientStreamWriter, args.WebSession.Response.ResponseHeaders).ConfigureAwait(false);

0 commit comments

Comments
 (0)