Commit 21f81907 authored by Honfika's avatar Honfika

fi for #652

parent a2e8172e
...@@ -22,8 +22,6 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -22,8 +22,6 @@ namespace Titanium.Web.Proxy.EventArguments
/// </summary> /// </summary>
public class SessionEventArgs : SessionEventArgsBase public class SessionEventArgs : SessionEventArgsBase
{ {
private static readonly byte[] emptyData = new byte[0];
/// <summary> /// <summary>
/// Backing field for corresponding public property /// Backing field for corresponding public property
/// </summary> /// </summary>
...@@ -110,7 +108,10 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -110,7 +108,10 @@ namespace Titanium.Web.Proxy.EventArguments
else else
{ {
var body = await readBodyAsync(true, cancellationToken); var body = await readBodyAsync(true, cancellationToken);
request.Body = body; if (!request.BodyAvailable)
{
request.Body = body;
}
// Now set the flag to true // Now set the flag to true
// So that next time we can deliver body from cache // So that next time we can deliver body from cache
...@@ -182,7 +183,10 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -182,7 +183,10 @@ namespace Titanium.Web.Proxy.EventArguments
else else
{ {
var body = await readBodyAsync(false, cancellationToken); var body = await readBodyAsync(false, cancellationToken);
response.Body = body; if (!response.BodyAvailable)
{
response.Body = body;
}
// Now set the flag to true // Now set the flag to true
// So that next time we can deliver body from cache // So that next time we can deliver body from cache
...@@ -595,7 +599,7 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -595,7 +599,7 @@ namespace Titanium.Web.Proxy.EventArguments
var response = new RedirectResponse(); var response = new RedirectResponse();
response.HttpVersion = HttpClient.Request.HttpVersion; response.HttpVersion = HttpClient.Request.HttpVersion;
response.Headers.AddHeader(KnownHeaders.Location, url); response.Headers.AddHeader(KnownHeaders.Location, url);
response.Body = emptyData; response.Body = Array.Empty<byte>();
Respond(response, closeServerConnection); Respond(response, closeServerConnection);
} }
......
...@@ -389,7 +389,10 @@ namespace Titanium.Web.Proxy.Http2 ...@@ -389,7 +389,10 @@ namespace Titanium.Web.Proxy.Http2
} }
} }
rr.Body = body; if (!rr.BodyAvailable)
{
rr.Body = body;
}
} }
rr.IsBodyRead = true; rr.IsBodyRead = true;
......
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