FlorianREGAZ / Python-Tls-Client

Advanced HTTP Library
MIT License
660 stars 136 forks source link

cookies not extracted in autoRedirect requests !!! #120

Open taoshiyu opened 4 months ago

taoshiyu commented 4 months ago

200 status request: request----cookie_extracted--->response 302 status request: request-----cookie_not_extract---->requests-----cookie_extracted---->response

only the last response headers set-cookies is extracted,the set-cookies in the redirected response headers ignored 302 redirect always happen in web login ,all the cookie must be extract

OculusVisionSellix commented 3 months ago

Can confirm. Very annoying!

taoshiyu commented 3 months ago

can do like this,stupid but work

  response = session.get(url, allow_redirects=False)
  while redirect_location := response.headers.get('Location'):
      response = session.get(redirect_location)
OculusVisionSellix commented 3 months ago

can do like this,stupid but work

  response = session.get(url, allow_redirects=False)
  while redirect_location := response.headers.get('Location'):
      response = session.get(redirect_location)

Yeah, that's possible, but still very ugly.

I just looked in the library and it looks like it has to do with the implementation, since the auto-redirects are handled by the Golang-Tls-Client and after the requests only the cookies from the last request being added to the session...

Maybe somebody is able to do a Pull Request, not sure tho...

pressplay01 commented 1 month ago

any fix here possible?