titanium-web-proxy
titanium-web-proxy copied to clipboard
Tunnel agent exception error
I'm using "Titanium-Web-Proxy" as Nintendo's switch console download accelerator. I use tunnel agents to do this function
var proxyServer = new ProxyServer();
var explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, 8000, false) {
};
explicitEndPoint.BeforeTunnelConnectRequest += ExplicitEndPoint_BeforeTunnelConnectRequest;
proxyServer.AddEndPoint(explicitEndPoint);
proxyServer.Start();
async private static Task ExplicitEndPoint_BeforeTunnelConnectRequest(object sender, Titanium.Web.Proxy.EventArguments.TunnelConnectSessionEventArgs e) {
e.DecryptSsl = false;
}
But there was an error downloading the game, and I used Fiddler without the problem
Use "Titanium-Web-Proxy" as a proxy game opportunity to prompt this error
2005-0140
With Fiddler, there's no such error, that you can download the game normally.
This is me using Fiddler as an upstream agent.
This is my direct use of Fiddler as an agent.

I don't know if it's helpful.
Titanium-Web-Proxy-master\src\Titanium.Web.Proxy\ExplicitClientHandler.cs
// write back successful CONNECT response
var response = ConnectResponse.CreateSuccessfulConnectResponse(connectRequest.HttpVersion);
// Set ContentLength explicitly to properly handle HTTP 1.0
response.ContentLength = -1;
response.Headers.FixProxyHeaders();
connectArgs.HttpClient.Response = response;
await clientStream.WriteResponseAsync(response, cancellationToken);
I found the wrong cause. I fixed this problem the way I got down there.
response.ContentLength = 0;->response.ContentLength = -1;
This line was added by @bjowes : https://github.com/justcoding121/Titanium-Web-Proxy/commit/1d06ec32fc3ac16a9be14aad19196be586abb6d4 and https://github.com/justcoding121/Titanium-Web-Proxy/commit/30870882fdccb4837ebf903647aab8abd05d524e
Is it really needed for HTTP/1.0?
This line was added by @bjowes : 1d06ec3 and 3087088
Is it really needed for HTTP/1.0?
Now should no longer exist http 1.0
Should support be provided as an option?
Maybe we should add a condition to check if it's HTTP/1.0 in connect request headline and use 0 or -1.