Commit 554069ba authored by titanium007's avatar titanium007

Fix bug caused by using wrong variable in SessionEventArgs

parent 167bb2f7
...@@ -25,7 +25,7 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -25,7 +25,7 @@ namespace Titanium.Web.Proxy.EventArguments
internal SessionEventArgs() internal SessionEventArgs()
{ {
Client = new ProxyClient(); Client = new ProxyClient();
WebSession = new HttpWebSession(); WebSession = new HttpWebClient();
} }
/// <summary> /// <summary>
...@@ -42,7 +42,7 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -42,7 +42,7 @@ namespace Titanium.Web.Proxy.EventArguments
/// A web session corresponding to a single request/response sequence /// A web session corresponding to a single request/response sequence
/// within a proxy connection /// within a proxy connection
/// </summary> /// </summary>
public HttpWebSession WebSession { get; set; } public HttpWebClient WebSession { get; set; }
/// <summary> /// <summary>
...@@ -87,7 +87,7 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -87,7 +87,7 @@ namespace Titanium.Web.Proxy.EventArguments
await this.Client.ClientStreamReader.CopyBytesToStream(requestBodyStream, WebSession.Request.ContentLength).ConfigureAwait(false); await this.Client.ClientStreamReader.CopyBytesToStream(requestBodyStream, WebSession.Request.ContentLength).ConfigureAwait(false);
} }
else if(WebSession.Response.HttpVersion.Major == 1 && WebSession.Response.HttpVersion.Minor == 0) else if(WebSession.Request.HttpVersion.Major == 1 && WebSession.Request.HttpVersion.Minor == 0)
await WebSession.ServerConnection.StreamReader.CopyBytesToStream(requestBodyStream, long.MaxValue).ConfigureAwait(false); await WebSession.ServerConnection.StreamReader.CopyBytesToStream(requestBodyStream, long.MaxValue).ConfigureAwait(false);
} }
WebSession.Request.RequestBody = await GetDecompressedResponseBody(WebSession.Request.ContentEncoding, requestBodyStream.ToArray()).ConfigureAwait(false); WebSession.Request.RequestBody = await GetDecompressedResponseBody(WebSession.Request.ContentEncoding, requestBodyStream.ToArray()).ConfigureAwait(false);
......
...@@ -9,7 +9,7 @@ using Titanium.Web.Proxy.Shared; ...@@ -9,7 +9,7 @@ using Titanium.Web.Proxy.Shared;
namespace Titanium.Web.Proxy.Http namespace Titanium.Web.Proxy.Http
{ {
public class HttpWebSession public class HttpWebClient
{ {
internal TcpConnection ServerConnection { get; set; } internal TcpConnection ServerConnection { get; set; }
...@@ -30,7 +30,7 @@ namespace Titanium.Web.Proxy.Http ...@@ -30,7 +30,7 @@ namespace Titanium.Web.Proxy.Http
ServerConnection = Connection; ServerConnection = Connection;
} }
internal HttpWebSession() internal HttpWebClient()
{ {
this.Request = new Request(); this.Request = new Request();
this.Response = new Response(); this.Response = new Response();
......
...@@ -236,6 +236,10 @@ namespace Titanium.Web.Proxy ...@@ -236,6 +236,10 @@ namespace Titanium.Web.Proxy
// so just return. // so just return.
return; return;
} }
catch
{
}
} }
......
...@@ -365,7 +365,7 @@ namespace Titanium.Web.Proxy ...@@ -365,7 +365,7 @@ namespace Titanium.Web.Proxy
await clientStreamWriter.FlushAsync().ConfigureAwait(false); await clientStreamWriter.FlushAsync().ConfigureAwait(false);
} }
private static void PrepareRequestHeaders(List<HttpHeader> requestHeaders, HttpWebSession webRequest) private static void PrepareRequestHeaders(List<HttpHeader> requestHeaders, HttpWebClient webRequest)
{ {
for (var i = 0; i < requestHeaders.Count; i++) for (var i = 0; i < requestHeaders.Count; i++)
{ {
......
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