Commit 32fb8174 authored by justcoding121's avatar justcoding121

set content-length correctly

parent 34a68075
...@@ -74,6 +74,8 @@ namespace Titanium.Web.Proxy.Http ...@@ -74,6 +74,8 @@ namespace Titanium.Web.Proxy.Http
header.Value = value.ToString(); header.Value = value.ToString();
else else
RequestHeaders.Add(new HttpHeader("content-length", value.ToString())); RequestHeaders.Add(new HttpHeader("content-length", value.ToString()));
IsChunked = false;
} }
else else
{ {
......
...@@ -91,6 +91,8 @@ namespace Titanium.Web.Proxy.Http ...@@ -91,6 +91,8 @@ namespace Titanium.Web.Proxy.Http
header.Value = value.ToString(); header.Value = value.ToString();
else else
ResponseHeaders.Add(new HttpHeader("content-length", value.ToString())); ResponseHeaders.Add(new HttpHeader("content-length", value.ToString()));
IsChunked = false;
} }
else else
{ {
......
...@@ -303,7 +303,7 @@ namespace Titanium.Web.Proxy ...@@ -303,7 +303,7 @@ namespace Titanium.Web.Proxy
{ {
args.WebSession.Request.RequestBody = await GetCompressedResponseBody(args.WebSession.Request.ContentEncoding, args.WebSession.Request.RequestBody); args.WebSession.Request.RequestBody = await GetCompressedResponseBody(args.WebSession.Request.ContentEncoding, args.WebSession.Request.RequestBody);
} }
//chunked send is not supported as of now
args.WebSession.Request.ContentLength = args.WebSession.Request.RequestBody.Length; args.WebSession.Request.ContentLength = args.WebSession.Request.RequestBody.Length;
var newStream = args.WebSession.ServerConnection.Stream; var newStream = args.WebSession.ServerConnection.Stream;
......
...@@ -66,9 +66,10 @@ namespace Titanium.Web.Proxy ...@@ -66,9 +66,10 @@ namespace Titanium.Web.Proxy
if (contentEncoding != null) if (contentEncoding != null)
{ {
args.WebSession.Response.ResponseBody = await GetCompressedResponseBody(contentEncoding, args.WebSession.Response.ResponseBody).ConfigureAwait(false); args.WebSession.Response.ResponseBody = await GetCompressedResponseBody(contentEncoding, args.WebSession.Response.ResponseBody).ConfigureAwait(false);
}
args.WebSession.Response.ContentLength = args.WebSession.Response.ResponseBody.Length; if (isChunked==false)
args.WebSession.Response.ContentLength = args.WebSession.Response.ResponseBody.Length;
}
await WriteResponseHeaders(args.Client.ClientStreamWriter, args.WebSession.Response.ResponseHeaders).ConfigureAwait(false); await WriteResponseHeaders(args.Client.ClientStreamWriter, args.WebSession.Response.ResponseHeaders).ConfigureAwait(false);
await WriteResponseBody(args.Client.ClientStream, args.WebSession.Response.ResponseBody, isChunked).ConfigureAwait(false); await WriteResponseBody(args.Client.ClientStream, args.WebSession.Response.ResponseBody, isChunked).ConfigureAwait(false);
......
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