Commit 1e8cf7e2 authored by Honfika's avatar Honfika

Use proxy renamed to use upstream proxy

parent d49448ea
......@@ -16,7 +16,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
internal ExternalProxy UpStreamHttpsProxy { get; set; }
internal ExternalProxy UpStreamProxy => UseProxy ? IsHttps ? UpStreamHttpsProxy : UpStreamHttpProxy : null;
internal ExternalProxy UpStreamProxy => UseUpstreamProxy ? IsHttps ? UpStreamHttpsProxy : UpStreamHttpProxy : null;
internal string HostName { get; set; }
......@@ -24,7 +24,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
internal bool IsHttps { get; set; }
internal bool UseProxy { get; set; }
internal bool UseUpstreamProxy { get; set; }
/// <summary>
/// Http version
......
......@@ -32,18 +32,18 @@ namespace Titanium.Web.Proxy.Network.Tcp
internal async Task<TcpConnection> CreateClient(ProxyServer server, string remoteHostName, int remotePort, Version httpVersion, bool isHttps,
ExternalProxy externalHttpProxy, ExternalProxy externalHttpsProxy)
{
bool useProxy = false;
bool useUpstreamProxy = false;
var externalProxy = isHttps ? externalHttpsProxy : externalHttpProxy;
//check if external proxy is set for HTTP/HTTPS
if (externalProxy != null && !(externalProxy.HostName == remoteHostName && externalProxy.Port == remotePort))
{
useProxy = true;
useUpstreamProxy = true;
//check if we need to ByPass
if (externalProxy.BypassLocalhost && NetworkHelper.IsLocalIpAddress(remoteHostName))
{
useProxy = false;
useUpstreamProxy = false;
}
}
......@@ -53,7 +53,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
try
{
//If this proxy uses another external proxy then create a tunnel request for HTTP/HTTPS connections
if (useProxy)
if (useUpstreamProxy)
{
#if NET45
client = new TcpClient(server.UpStreamEndPoint);
......@@ -136,7 +136,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
HostName = remoteHostName,
Port = remotePort,
IsHttps = isHttps,
UseProxy = useProxy,
UseUpstreamProxy = useUpstreamProxy,
TcpClient = client,
StreamReader = new CustomBinaryReader(stream, server.BufferSize),
Stream = stream,
......
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