-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support rack 3 cookies #3164
Support rack 3 cookies #3164
Conversation
* request.rb - allow header array value * test_response_header.rb - add test
Wouldn't it be better if such Rails release set the requirement for Puma to 6? Cc @ioquatix @rafaelfranca (I guess Rails doesn't have a hard requirement on Puma? 🤔 Just new installations that get something in their Gemfiles?) |
I don't fully understand the issue. Is it because Puma 5 is allowing Rails 3 without actually fully supporting it? |
Puma has no dependency on Rack |
Exactly, Rails doesn't require Puma, but Puma is the default when generating a new app. So, every app generated from Rails 6.1 and after won't benefit from changing the Puma version in rails. I was searching for the best place to put a check that would mitigate the issue with minimal impact.
Assuming Rails -> Rack: Yes, but adding a gemspec restriction would not work because I feel like Puma is the best place for the check, but it is really a Rails issue. If you think a check in Rails is preferable, I can open an issue or a PR on the Rails repo. |
I spent a bit working on this. Getting CI to pass will be non-trivial. Part if the issue is loading any part of Rack affects other tests. Or, when running the test files in isolation (or one at a time), they all pass, but loading them all in the same process causes failures.
I agree with both. I'm not going to pretend I'm familiar with every framework that can use Puma, but any framework using Puma and Rack may face similar issues. Hence, Puma is probably the best place for the check... It's too bad Bundler/RubyGems doesn't allow for 'constraints' on gems that aren't dependencies, but I suspect that could be very messy... |
Preventing the app from booting is probably preferable then. I opened a PR doing that here. I had to close the original one, (I could not change the base repo). If everyone agree that Puma is the best place for a check and we should prevent booting instead of supporting Rack 3 on Puma 5, I'll close this PR and continue working on the other one. |
Oh shoot. I missed that. It means I can't just |
Yes, preventing booting (or print warning?) is probably the best we can do for Puma 5 – I don't think it is resonable to get Puma 5 compatible with Rack 3 |
Puma 5.x is not compatible with Rack 3 cookies. The current default new Gemfile uses puma ">= 5.0". Puma ~> 5.6 will error on start when used with Rack 3, but earlier versions will not. puma/puma#3164: Support Rack 3 cookies puma/puma#3166: Prevent loading with rack 3 phusion/passenger#2503: Related passenger ex
This is a cherry pick of e2ef83b
Description
Rack 3 switched to arrays for cookies. Puma 6 already supports it (e2ef83b).
The problem if we don't backport this to Puma 5 is that a whole lot of people are about to hit this error.
I built a minimal repro of the issue here.
Since Rails 6.1, Rails has
gem "puma", "~> 5.0"
as the default web server.This means that anyone who started a Rails app since 6.1 will hit the issue if they run
bundle update
after Rails 7.1 releases as Rails main removed the upper bound for rackIf they run
bundle update rails
there is not much we can do as it won't update Puma, but if we can mitigate the issue for anyone runningbundle update
this could solve a lot headache.I doubt this is the only incompatibility with Rack 3. It might be too much to cherry pick everything, so I made this PR as an alternative. This alternative PR would prevent Puma 5 from starting if Rack 3 is loaded. I didn't open it on this repo (lives in my fork), I'll switch it if this approach is preferred.
Your checklist for this pull request
[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.