justcoding121 / titanium-web-proxy

A cross-platform asynchronous HTTP(S) proxy server in C#.
MIT License
1.93k stars 618 forks source link

Problem with GetCustomUpStreamProxyFunc and CustomUpStreamProxyFailureFunc #907

Open davideciarmiello opened 2 years ago

davideciarmiello commented 2 years ago

Hi. i have a problem with a proxy chain. i have two proxies. The first getted in func GetCustomUpStreamProxyFunc, and this proxy fail for test. The second, getted in CustomUpStreamProxyFailureFunc, is valid, but the request will fail. Why? If i return the second proxy in the first method GetCustomUpStreamProxyFunc, all works.

i view in the TcpConnectionFactory.cs

var newUpstreamProxy = await proxyServer.CustomUpStreamProxyFailureFunc(sessionArgs); if (newUpstreamProxy != null) { sessionArgs.CustomUpStreamProxyUsed = newUpstreamProxy; sessionArgs.TimeLine["Retrying Upstream Proxy Connection"] = DateTime.UtcNow; return await createServerConnection(remoteHostName, remotePort, httpVersion, isHttps, sslProtocol, applicationProtocols, isConnect, proxyServer, sessionArgs, upStreamEndPoint, externalProxy, cacheKey, prefetch, cancellationToken); }

Passed the parameter externalProxy, is this the problem? and not passed newUpstreamProxy . It's possible to read a last exception in the method CustomUpStreamProxyFailureFunc?

Thanks!