Commit 80de6eac authored by Honfika's avatar Honfika

handling keepalive properly when user respond in the BeforeRequest handler

parent 989b6cad
......@@ -429,12 +429,20 @@ namespace Titanium.Web.Proxy
await BeforeRequest.InvokeAsync(this, args, ExceptionFunc);
}
var response = args.WebSession.Response;
if (args.WebSession.Request.CancelRequest)
{
await HandleHttpSessionResponse(args);
if (!response.KeepAlive)
{
break;
}
continue;
}
//create a new connection if hostname/upstream end point changes
if (connection != null
&& (!connection.HostName.Equals(args.WebSession.Request.RequestUri.Host, StringComparison.OrdinalIgnoreCase)
......@@ -450,8 +458,6 @@ namespace Titanium.Web.Proxy
connection = await GetServerConnection(args, false);
}
var response = args.WebSession.Response;
//if upgrading to websocket then relay the requet without reading the contents
if (args.WebSession.Request.UpgradeToWebSocket)
{
......@@ -491,7 +497,7 @@ namespace Titanium.Web.Proxy
await HandleHttpSessionRequestInternal(connection, args);
//if connection is closing exit
if (response.KeepAlive == false)
if (!response.KeepAlive)
{
break;
}
......
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