-
-
Notifications
You must be signed in to change notification settings - Fork 92
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 3 support #277
base: main
Are you sure you want to change the base?
Rack 3 support #277
Conversation
Excellent! Thanks so much for doing this. It'll be a huge win when we can make a release that supports Rack 3. Looks like there are some Rubocop errors, can you fix those? I have a few questions (for you and others):
|
thanks for checking this out @cllns ! fixed the rubocop offenses
|
Sweet! If it's possible, I think that would be best, so we can keep this a minor version release. We'll have to add rack-version to our CI matrix, but that's not a problem. It makes sense for a router. Now that I think about it, even if Rack 3 is optional, we don't want users who are setting mixed-case headers to break their apps, so we should use Rack::Headers regardless.
Outside of whether we need it, I feel like there might be reasons we want rewindable input... I guess it's more performant to keep the same input & rewind it instead of copying everything we need over. Plus users may be rewinding already (e.g. in middleware) and we don't want that to break. Curious how others feel about this. I think it might make sense to use rewindable input by default for Rack 3 (maybe based on content type?) but hopefully there's a way to automatically allow non-rewindable inputs as well, for streams. If it can't be automatic then we should try to make it simple to opt-out of rewindable inputs. I wish I knew more about Rack. I've read the UPGRADE_GUIDE, and started 'watching' the repo a couple weeks ago, so hopefully I can get a better grasp on it.
Looking into it, the Rack::ContentLength middleware only applies to responses that don't have the header already set. What if we just set it in hanami/hanami and leave it out of the router? Then we can document how users can add it. This keeps the router as small and flexible as possible. I think it's probably better to set it ourselves in the framework than rely on the middleware (which seems like more of a fallback).
This is already a big change (across several repos, thank you!), so I think it'd be wise to keep the scope of this as small as we can. Then we can work on Rack 3+ features, and ship those independently. So I think at this point:
Then we can get these merged, and work on non-rewindable inputs in separate PR's. We could ship rewindable-only Rack 3 support or wait until we actually support non-rewindable input to ship a new versions of the gems. Curious to get @timriley's feedback :) |
multiple gems are impacted and updated by this change. this gem is the most significantly changed. i'll link to the open PR's of the affected gems below. please let me know if you'd like to see any changes, thanks!
highlights
changelog for Rack 3: https://github.com/rack/rack/blob/main/UPGRADE-GUIDE.md
response headers are now required to be lower case
rack.input
is now no longer rewindablesome specs needed updating, on account that the
content-length
response header no longer a part of the implementation ofRack::Response
. this change happened in v2.1, and while not directly related to Rack 3, was included here to get all greenimpacted gems