open-uri
open-uri copied to clipboard
Handle cookies when handling HTTP redirects
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 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.
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.