Skip to content
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.x and rackup #435

Merged
merged 3 commits into from
Feb 7, 2025

Conversation

and9000
Copy link
Contributor

@and9000 and9000 commented Feb 2, 2025

Hello,

following what have been done in #399 I was trying to see if I was able to upgrade resque ( resque/resque#1912 ) to support rack 3.x. As it wasn't working, digging a little I think thin is missing one last bit in order to be able to work both with rack 2/3 and with/without rackup gem. I've taken inspiration on what has been done in puma puma/puma#3532.

Thanks,
Andrea

* fixed register Thin with rack/rackup
@and9000
Copy link
Contributor Author

and9000 commented Feb 4, 2025

Hi @ioquatix , sorry to bother, could you have a look at this please? AFAIK this is needed for Thin to support rack/rackup. Thanks!

@ioquatix
Copy link
Collaborator

ioquatix commented Feb 4, 2025

Thanks for your effort.

IMHO, It's better to have separate files, like this:

Using a shared implementation, rather than trying to sniff the constants which is fragile.

Are you able to update the implementation / PR to follow that model?

@and9000
Copy link
Contributor Author

and9000 commented Feb 4, 2025

Sure, I will do in the next days and update the PR, thanks!

@ioquatix
Copy link
Collaborator

ioquatix commented Feb 4, 2025

Looking forward to it!

* Split classes Rack/Rackup::Handler::Thin
* Updated CI to run on rack 1/2/3
@and9000
Copy link
Contributor Author

and9000 commented Feb 6, 2025

Done, I've also updated CI to run on all rack versions.

* fixed CI: ruby 3.0 means latest 3.x release while "3.0" means latest 3.0.x release
* added CI build for macos with rack v3
* added CI build for ruby: head with rack v3
@and9000
Copy link
Contributor Author

and9000 commented Feb 7, 2025

Should be green now (see same PR on my fork and9000#3 😄 ). It was red as the ruby version 3.0 points to latest 3.x while "3.0" points to 3.0.x and rack v1 doesn't work with latest ruby versions see below.

I've excluded CI for ruby 3.3/3.4 against rack v1 as 3.3 introduced a breaking change in Regexp.new, see Compatibility issues in ruby 3.3 release notes.

I've added also macos build against rack v3 and ruby: head against rack v3.

@ioquatix ioquatix merged commit dbf793a into macournoyer:master Feb 7, 2025
24 checks passed
@ioquatix
Copy link
Collaborator

ioquatix commented Feb 7, 2025

Thanks for your contribution.

Do you know if anything else is required to support Rack 3? Or can we start considering to make a new release of thin?

@and9000 and9000 deleted the support_rack_3_x_and_rackup branch February 8, 2025 08:00
@and9000
Copy link
Contributor Author

and9000 commented Feb 8, 2025

AFAIK no nothing else is required, this was the last bit to support Rack 3.

I would love to see a new thin release! 😄

@ioquatix
Copy link
Collaborator

ioquatix commented Feb 9, 2025

I reviewed the code and there is a missing piece.

We need to copy something like this: https://github.com/socketry/protocol-rack/blob/16197ef7bbf0be383e5a3b56f98068f925a9f313/lib/protocol/rack/adapter/rack3.rb#L22-L64

Or make the environment construction conditional on the Rack version, as some variables have been removed or modified.

We should probably add tests to rack-conform to detect these differences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants