Commit 383ec0a4 authored by ilushka85's avatar ilushka85

support reading body if contentlength 0 and has not been read yet

parent 4b9f4acb
...@@ -143,7 +143,7 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -143,7 +143,7 @@ namespace Titanium.Web.Proxy.EventArguments
WebSession.Response.ContentLength); WebSession.Response.ContentLength);
} }
else if (WebSession.Response.HttpVersion.Major == 1 && WebSession.Response.HttpVersion.Minor == 0) else if ((WebSession.Response.HttpVersion.Major == 1 && WebSession.Response.HttpVersion.Minor == 0) || WebSession.Response.ContentLength == -1)
{ {
await WebSession.ServerConnection.StreamReader.CopyBytesToStream(bufferSize, responseBodyStream, long.MaxValue); await WebSession.ServerConnection.StreamReader.CopyBytesToStream(bufferSize, responseBodyStream, long.MaxValue);
} }
......
...@@ -425,15 +425,11 @@ namespace Titanium.Web.Proxy ...@@ -425,15 +425,11 @@ namespace Titanium.Web.Proxy
{ {
if (tcpClient != null) if (tcpClient != null)
{ {
if (tcpClient.LingerState != null)
{
tcpClient.LingerState = new LingerOption(true, 0);
}
tcpClient.Client.Shutdown(SocketShutdown.Both); tcpClient.Client.Shutdown(SocketShutdown.Both);
tcpClient.Client.Close(); tcpClient.Client.Close();
tcpClient.Client.Dispose(); tcpClient.Client.Dispose();
tcpClient.Close(); tcpClient.Close();
} }
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment