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

Add Rack 3 compatibility #146

Merged
merged 1 commit into from Oct 18, 2023
Merged

Add Rack 3 compatibility #146

merged 1 commit into from Oct 18, 2023

Conversation

agfor
Copy link
Contributor

@agfor agfor commented Oct 13, 2023

This commit adds compatibility with Rack 3 and rack-test 2 while maintaining backwards compatibility.

Rack no longer depends on WEBrick since it's not a default gem in recent versions of Ruby, so add the Rackup gem to restore that functionality.

Use read instead of string to get the request body in a compatible way.

spec/integration/cli_spec.rb expected the pact files to get written before the server is shut down, whereas all the other similar specs, e.g. spec/integration/control_server_cli_spec.rb, shut the server down before expecting the files to be present. I'm not sure why exactly this works with Rack 2 but not Rack 3, or why it was just this one file that was different, but given all the other files follow the shut-down-the-server pattern, I changed this file to do the same. All of the assertions are still tested, the setup is the only thing that was changed.

Fixes #145

There is at least one known security vulnerability in Rack 2 rack/rack#1732 so releasing a new version with this change ASAP would be excellent.

@agfor
Copy link
Contributor Author

agfor commented Oct 18, 2023

@bethesque Sorry for the ping, but this is blocking a security upgrade for us, so I wanted to check if you'll be able to take a look at this soon? Thank you!

@@ -66,7 +66,11 @@ def responsive?
end

def run_default_server(app, port)
require 'rack/handler/webrick'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we have rackup declared as a dependency now, do we need to use this approach, or could we go straight to requiring rackup?

@bethesque
Copy link
Member

@YOU54F there's nothing in the pact-ruby-standalone that needs ruby 2.7 support any more is there?

@bethesque bethesque merged commit 9afea51 into pact-foundation:master Oct 18, 2023
13 checks passed
@YOU54F
Copy link
Member

YOU54F commented Oct 19, 2023

@YOU54F there's nothing in the pact-ruby-standalone that needs ruby 2.7 support any more is there?

Negative, we were in-fact blocked by the pact mock service, pinning to rack 2.x in upgrading to the latest version of Rack, it was only pact mock service that relied on it in the pact-ruby-standalone bundle

some related PR's in pact-ruby related to the rack 3 dep

@YOU54F
Copy link
Member

YOU54F commented Oct 19, 2023

Thank you @agfor, appreciate this alot!

Will get the Rack dep updated in Pact ruby standalone 👍🏾

https://github.com/pact-foundation/pact-ruby-standalone/blob/1886f76ff2564839411c983636e9411390fcd7de/packaging/Gemfile#L8-L9

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.

Update to rack 3
3 participants