Commit 61a41535 authored by Honfika's avatar Honfika

set the Ok method headers parameter to optional to make it work with the -...

set the Ok method headers parameter to optional to make it work with the - commented out - sample in ProxyTestController
parent 185da2a8
...@@ -536,16 +536,18 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -536,16 +536,18 @@ namespace Titanium.Web.Proxy.EventArguments
/// </summary> /// </summary>
/// <param name="html"></param> /// <param name="html"></param>
/// <param name="headers"></param> /// <param name="headers"></param>
public async Task Ok(string html, Dictionary<string, HttpHeader> headers) public async Task Ok(string html, Dictionary<string, HttpHeader> headers = null)
{ {
var response = new OkResponse(); var response = new OkResponse();
if (headers != null)
{
response.Headers.AddHeaders(headers); response.Headers.AddHeaders(headers);
}
response.HttpVersion = WebSession.Request.HttpVersion; response.HttpVersion = WebSession.Request.HttpVersion;
response.Body = response.Encoding.GetBytes(html ?? string.Empty); response.Body = response.Encoding.GetBytes(html ?? string.Empty);
await Respond(response); await Respond(response);
WebSession.Request.CancelRequest = true;
} }
/// <summary> /// <summary>
......
...@@ -818,13 +818,13 @@ namespace Titanium.Web.Proxy ...@@ -818,13 +818,13 @@ namespace Titanium.Web.Proxy
try try
{ {
if (endPoint.GetType() == typeof(TransparentProxyEndPoint)) if (endPoint is TransparentProxyEndPoint tep)
{ {
await HandleClient(endPoint as TransparentProxyEndPoint, tcpClient); await HandleClient(tep, tcpClient);
} }
else else
{ {
await HandleClient(endPoint as ExplicitProxyEndPoint, tcpClient); await HandleClient((ExplicitProxyEndPoint)endPoint, tcpClient);
} }
} }
finally finally
......
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