Unverified Commit 53ba585d authored by honfika's avatar honfika Committed by GitHub

Merge pull request #624 from justcoding121/master

Fix for #593 and #596
parents 7e0ad5c6 ba428196
using System;
namespace Titanium.Web.Proxy.Extensions
{
internal static class UriExtensions
{
internal static string GetOriginalPathAndQuery(this Uri uri)
{
string leftPart = uri.GetLeftPart(UriPartial.Authority);
if (uri.OriginalString.StartsWith(leftPart))
return uri.OriginalString.Substring(leftPart.Length);
return uri.IsWellFormedOriginalString() ? uri.PathAndQuery : uri.GetComponents(UriComponents.PathAndQuery, UriFormat.Unescaped);
}
}
}
......@@ -104,8 +104,7 @@ namespace Titanium.Web.Proxy.Http
}
else
{
var uri = Request.RequestUri;
url = uri.IsWellFormedOriginalString() ? uri.PathAndQuery : uri.GetComponents(UriComponents.PathAndQuery, UriFormat.Unescaped);
url = Request.RequestUri.GetOriginalPathAndQuery();
}
// prepare the request & headers
......
......@@ -327,6 +327,9 @@ namespace Titanium.Web.Proxy.Network.Tcp
{
throw new Exception($"Could not establish connection to {hostname}", e);
}
// dispose the current TcpClient and try the next address
tcpClient?.Dispose();
}
}
......
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