Commit 9f747316 authored by Honfika's avatar Honfika

redundant parameter removed

parent bb6be9d4
......@@ -65,7 +65,7 @@ namespace Titanium.Web.Proxy.EventArguments
{
bytesRemaining = -1;
//chunk trail
// chunk trail
baseStream.ReadLineAsync().Wait();
}
}
......
......@@ -88,14 +88,14 @@ namespace Titanium.Web.Proxy.EventArguments
var request = WebSession.Request;
//If not already read (not cached yet)
// If not already read (not cached yet)
if (!request.IsBodyRead)
{
var body = await ReadBodyAsync(true, cancellationToken);
request.Body = body;
//Now set the flag to true
//So that next time we can deliver body from cache
// Now set the flag to true
// So that next time we can deliver body from cache
request.IsBodyRead = true;
OnDataSent(body, 0, body.Length);
}
......@@ -106,7 +106,7 @@ namespace Titanium.Web.Proxy.EventArguments
/// </summary>
internal async Task ClearResponse(CancellationToken cancellationToken)
{
//syphon out the response body from server
// syphon out the response body from server
await SyphonOutBodyAsync(false, cancellationToken);
WebSession.Response = new Response();
}
......@@ -139,14 +139,14 @@ namespace Titanium.Web.Proxy.EventArguments
return;
}
//If not already read (not cached yet)
// If not already read (not cached yet)
if (!response.IsBodyRead)
{
var body = await ReadBodyAsync(false, cancellationToken);
response.Body = body;
//Now set the flag to true
//So that next time we can deliver body from cache
// Now set the flag to true
// So that next time we can deliver body from cache
response.IsBodyRead = true;
OnDataReceived(body, 0, body.Length);
}
......@@ -196,7 +196,7 @@ namespace Titanium.Web.Proxy.EventArguments
long contentLength = request.ContentLength;
//send the request body bytes to server
// send the request body bytes to server
if (contentLength > 0 && hasMulipartEventSubscribers && request.IsMultipartFormData)
{
var reader = GetStreamReader(true);
......@@ -323,7 +323,7 @@ namespace Titanium.Web.Proxy.EventArguments
if (bufferDataLength == buffer.Length)
{
//boundary is not longer than 70 bytes according to the specification, so keeping the last 100 (minimum 74) bytes is enough
// boundary is not longer than 70 bytes according to the specification, so keeping the last 100 (minimum 74) bytes is enough
const int bytesToKeep = 100;
Buffer.BlockCopy(buffer, buffer.Length - bytesToKeep, buffer, 0, bytesToKeep);
bufferDataLength = bytesToKeep;
......
......@@ -53,14 +53,14 @@ namespace Titanium.Web.Proxy.EventArguments
{
var remoteEndPoint = ClientEndPoint;
//If client is localhost get the process id
// If client is localhost get the process id
if (NetworkHelper.IsLocalIpAddress(remoteEndPoint.Address))
{
var ipVersion = endPoint.IpV6Enabled ? IpVersion.Ipv6 : IpVersion.Ipv4;
return TcpHelper.GetProcessIdByLocalPort(ipVersion, remoteEndPoint.Port);
}
//can't access process Id of remote request from remote machine
// can't access process Id of remote request from remote machine
return -1;
}
......
......@@ -277,9 +277,8 @@ namespace Titanium.Web.Proxy
}
//Now create the request
await HandleHttpSessionRequest(endPoint, clientConnection, clientStream,
clientStreamWriter, cancellationTokenSource, connectHostname,
connectArgs?.WebSession.ConnectRequest);
await HandleHttpSessionRequest(endPoint, clientConnection, clientStream, clientStreamWriter,
cancellationTokenSource, connectHostname, connectArgs?.WebSession.ConnectRequest);
}
catch (ProxyException e)
{
......
......@@ -31,10 +31,10 @@ namespace Titanium.Web.Proxy.Extensions
try
{
//This line is important!
//contributors please don't remove it without discussion
//It helps to avoid eventual deterioration of performance due to TCP port exhaustion
//due to default TCP CLOSE_WAIT timeout for 4 minutes
// This line is important!
// contributors please don't remove it without discussion
// It helps to avoid eventual deterioration of performance due to TCP port exhaustion
// due to default TCP CLOSE_WAIT timeout for 4 minutes
if (socketCleanedUpGetter == null || !socketCleanedUpGetter(tcpClient.Client))
{
tcpClient.LingerState = new LingerOption(true, 0);
......
......@@ -44,8 +44,7 @@ namespace Titanium.Web.Proxy
/// <returns></returns>
private async Task HandleHttpSessionRequest(ProxyEndPoint endPoint, TcpClientConnection clientConnection,
CustomBufferedStream clientStream, HttpResponseWriter clientStreamWriter,
CancellationTokenSource cancellationTokenSource, string httpsConnectHostname, ConnectRequest connectRequest,
bool isTransparentEndPoint = false)
CancellationTokenSource cancellationTokenSource, string httpsConnectHostname, ConnectRequest connectRequest)
{
var cancellationToken = cancellationTokenSource.Token;
TcpServerConnection serverConnection = null;
......@@ -123,9 +122,10 @@ namespace Titanium.Web.Proxy
args.ProxyClient.ClientStream = clientStream;
args.ProxyClient.ClientStreamWriter = clientStreamWriter;
if (!args.IsTransparent)
{
//proxy authorization check
if (!args.IsTransparent && httpsConnectHostname == null &&
await CheckAuthorization(args) == false)
if (httpsConnectHostname == null && await CheckAuthorization(args) == false)
{
await InvokeBeforeResponse(args);
......@@ -135,8 +135,6 @@ namespace Titanium.Web.Proxy
return;
}
if (!isTransparentEndPoint)
{
PrepareRequestHeaders(request.Headers);
request.Host = request.RequestUri.Authority;
}
......
......@@ -99,7 +99,7 @@ namespace Titanium.Web.Proxy
int available = clientStream.Available;
if (available > 0)
{
//send the buffered data
// send the buffered data
var data = BufferPool.GetBuffer(BufferSize);
try
......@@ -126,7 +126,7 @@ namespace Titanium.Web.Proxy
//HTTPS server created - we can now decrypt the client's traffic
//Now create the request
await HandleHttpSessionRequest(endPoint, clientConnection, clientStream, clientStreamWriter,
cancellationTokenSource, isHttps ? httpsHostName : null, null, true);
cancellationTokenSource, isHttps ? httpsHostName : null, null);
}
catch (ProxyException e)
{
......
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