justcoding121 / titanium-web-proxy

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

Timeouts for individual requests #945

Open enkelmedia opened 1 year ago

enkelmedia commented 1 year ago

Hi!

Not sure where to post this so I ended up here. I've downloaded the source code and tried to the best of my ability to understand but I can't seem to find an answer to my question on my own.

I'm using Titanium as a proxy when I'm crawling websites, I set it up as a proxy for Chrome and then run Chrome using the W3C WebDriver protocol. Sometimes a website have assets that takes very long to load and I would like to send an "abort time" for these assets. So let's say I'm loading a page and wait for 10 seconds, then I would like all connections to be dropped and maybe return a 400 or 404 or something.

So I'm basically looking for a way to configure an individual request to timeout if the upstream does not respond in X seconds. I could also be the same timeout for all requests. I've looked at the "connection timeout"-settings on the ProxyServer and also looked for some kind of timeout in the "BeforeRequest"-event but without any luck.

Does anyone know if there is a way to do this or should I just give up?

Thank you very much!