open-uri icon indicating copy to clipboard operation
open-uri copied to clipboard

Handle cookies when handling HTTP redirects

Open jeremyevans opened this issue 5 years ago • 2 comments

This approach will handle the Set-Cookie header during the redirect. To avoid redirect loops for arbitrary cookies and the same URI, it will not redirect to an URI more than once for the cookie/non-cookie cases.

Implements Ruby Feature #11322

jeremyevans avatar Nov 13 '20 03:11 jeremyevans

@jeremyevans How do you feel explicitly specified redirect limit at https://github.com/ruby/open-uri/pull/18 ?

I felt #18 is better because there is no breaking change rather than this.

hsbt avatar Nov 09 '23 08:11 hsbt

I think the changes are orthogonal. Supporting a max limit of redirects as in #18 seems like a good idea. However, redirects that set cookies and rely on the cookies being submitted in future requests will still be broken without this, so I still think this is a good approach.

jeremyevans avatar Nov 09 '23 15:11 jeremyevans