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

RACK_INPUT not rewound on form data #2152

Closed
dblock opened this issue Jan 31, 2024 · 2 comments
Closed

RACK_INPUT not rewound on form data #2152

dblock opened this issue Jan 31, 2024 · 2 comments

Comments

@dblock
Copy link
Contributor

dblock commented Jan 31, 2024

Coming from slack-ruby/slack-ruby-client#506, it looks like Rack 2.x called rewind on RACK_INPUT for form data.

In 2.x it used to call .rewind explicitly after reading the form data.

https://github.com/rack/rack/blob/2-2-stable/lib/rack/request.rb#L456

And it no longer does in 3.x.

form_vars = get_header(RACK_INPUT).read

This causes anyone accessing http_request.body to get an empty value.

Was this by design? I can add a test/fix if it's not.

@jeremyevans
Copy link
Contributor

Yes, this is expected, and mentioned in the upgrade guide: https://github.com/rack/rack/blob/main/UPGRADE-GUIDE.md#rackinput-is-no-longer-required-to-be-rewindable. You can use Rack::RewindableInput::Middleware if you would like the request body to be rewindable, as it was in Rack 2.

@dblock
Copy link
Contributor Author

dblock commented Jan 31, 2024

Thanks, should have checked, my bad.

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

No branches or pull requests

2 participants