Closed korbin closed 3 months ago
Ah yes, that comment is incorrect.
It's a security issue to redirect to absolute URLs IMHO.
I'll fix the documentation.
I agree that following redirects shouldn't be implicit and could potentially present security issues.
We've found there are plenty of places where absolute redirects are necessary and safe: following redirects to S3 pre-signed URLs being an easy, obvious case.
URI::HTTP.open
does seem to follow all same-scheme redirects by default.
RelativeLocation
though.Thanks for the quick follow-up!
In
RelativeLocation
, we immediately return if a URI is absolute:Perhaps I am using it wrong, but it seems like this doesn't follow the absolute redirect as it should?
If I change this block, the
while
loop correctly iterates and the redirect is transparently followed as I would expect:Maybe this isn't the intended behavior (please close this issue and disregard) or I am using the library incorrectly - I didn't see a test for absolute redirects, but the comments seem to indicate that this is a "Client wrapper which transparently handles both relative and absolute redirects to a given maximum number of hops."