Noooste / azuretls-client

An easy-to-use HTTP client 100% in Go to spoof TLS/JA3 and HTTP2 fingerprint
MIT License
162 stars 21 forks source link

[Feature request] CheckRedirect hook. #101

Closed sagan closed 2 months ago

sagan commented 2 months ago

The current behavior of azuretls-client's redirect following does not preserve the request scope OrderedHeaders of the original request. To persist headers across redirections, one has to use the session scope OrderedHeaders, which is not ideal in some circumstances (For example, I am setting the Cookie headers and I don't use azuretls's built in cookie jar by always setting req.NoCookie flag).

I suggest adding a new CheckRedirect hook, similar to go standard http client's CheckRedirect. It will allow user gain more control of the redirection, like setting headers or other parameters of the new request, or even prevent the redirection. it may looks like:

func CheckRedirect(req *Request, reqs []*Request) error

It could be a session scope or request scope hook, or both.

Noooste commented 2 months ago

Hi, thanks for pointing that out, I think it's a good feature that needs to be implemented.