-
Notifications
You must be signed in to change notification settings - Fork 12
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
Require the webrick handler when webrick is available #27
Conversation
I understand the value of the PR. However, the entry point should be: https://github.com/rack/rackup/blob/main/lib/rackup/handler.rb#L40-L56 Rackup::Handler.get(:webrick) This will return whatever has been registered as that handler, and would handle compatibility issues w.r.t. the older Thoughts? |
Yes, that's true. It should be used but it is not always the case. A github issue search yields yabeda-rb/yabeda-prometheus#32 which this would help with. I think it's reasonable to fix breakage from a minor version change if possible Going through with this would soften the blow a bit but personally I'm not affected. |
Yes, I agree with the compatibility angle, so I'm probably okay to merge this PR just on that basis. Out of curiosity, is there any way we can steer people in the right direction? e.g. |
I'm not sure how you would achieve that tbh. I have no idea how puma handles it, if the handler is required through the main entrypoint (probably not if I had to guess), it's just a bit unfortunate that for webrick that used to be the case. If capybara used |
It does raise a somewhat interesting question. But rackup seems to be pretty much in maintanence mode so I'd guess not much going on here in the future. The last 2 years were already very sparse. So I don't mind fixing it here in this case. |
I agree with your sentiment regarding I don't want to cause too many downstream problems either though. We should encourage downstream to use |
Followup to rack#23 Even when users do add webrick to their gemfile, the handler is not available. This means that they either need to do that themselves, or dependencies need to be updated.
8661627
to
db13822
Compare
I am okay with this so I have merged it. However, I'm thinking about downstream users who don't want webrick. I wonder if we could use |
Released in v2.2.1. @fxn do you have any thoughts on how to improve this? (autoload etc). |
I started out with I guess you could do a combination of the two? Do Edit: Ah, nevermind. I completely missed the mark with this. It will not change anything about what you've written. If you go with autoloading, you should make sure that loading the handler doesn't emit the ruby warning during it. |
Followup to #23.
Even when users do add webrick to their gemfile, the handler is not available. This means that they either need to do that themselves, or their dependencies need to be updated. A quick search shows a handful of matches: https://github.com/search?q=%2FRackup%3A%3AHandler%3A%3AWEBrick%2F+lang%3Aruby+-is%3Afork&type=code
I noticed that capybara already does require the handler here but it doesn't have to. Just requiring
rackup
previously made it available. I think it's a fair assumption that there is code out there that would be impacted by this.