-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FollowRedirects throws NoMethodError on malformed Location #171
Comments
That totally makes sense, I'd happily review a PR that raises a particular exception in such a case 👍 |
How to reproduce this? I get 'ArgumentError: no HTTP request path given' with malformed redirect url. |
One site where this happens is http:https://macmiep.nl/ (it redirects to https:/// so it should be fairly easy to set up another site with the same effect). |
Thanks @graaff, that looks like a great use-case for a unit test! |
In one of our projects we are checking old links, and one of them throws a NoMethodError when using the FollowRedirects middleware. This happens because the Location: is malformed and the site tries to redirect to "http:https://". This causes the following NoMethodError:
I could catch the NoMethodError in my calling method to catch this, but I'm a bit wary to catch a generic error here. Perhaps the FollowRedirect module should validate that the redirected location is a valid URL before redirecting?
The text was updated successfully, but these errors were encountered: