-
Notifications
You must be signed in to change notification settings - Fork 375
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
Fix URI::InvalidURIError
#2310
Fix URI::InvalidURIError
#2310
Conversation
`env['REQUEST_URI']` is often only path, but in some environments (e.g. WEBrick) it containts the base url.
Codecov Report
@@ Coverage Diff @@
## master #2310 +/- ##
==========================================
- Coverage 97.58% 97.55% -0.03%
==========================================
Files 1094 1076 -18
Lines 57400 56792 -608
==========================================
- Hits 56015 55405 -610
- Misses 1385 1387 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@yujideveloper Thanks for this fix! I updated your branch with a couple of additional test cases. Otherwise, LGTM! |
e8b65e1
to
450c7cd
Compare
@lloeki |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Hey @yujideveloper, this has been released as part of 1.5.1, thank you for your contribution! |
@gingerlime FYI the fix in #2328 has been released in v1.5.2 |
Thanks so much @lloeki 👍 🙏 |
What does this PR do?
This fixes
URI::InvalidURIError
when it runs on WEBrick.This error introduced in v1.5.0 (#2265).
Additional Notes
env['REQUEST_URI']
is often only path, but in some environments (e.g. WEBrick) it contains the base url (e.g.http://localhost:3000/foo/bar
).https://github.com/ruby/webrick/blob/v1.7.0/lib/webrick/httprequest.rb#L423
https://github.com/ruby/webrick/blob/v1.7.0/lib/webrick/httprequest.rb#L218
https://github.com/ruby/webrick/blob/v1.7.0/lib/webrick/httprequest.rb#L484-L505
How to test the change?
Start rails server on WEBrick and access app via web browser (e.g.
http://localhost:300/foo
).My environment is below: