-
Notifications
You must be signed in to change notification settings - Fork 789
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 #758
Rack 3 support #758
Conversation
@@ -2,7 +2,7 @@ | |||
|
|||
Get upgrade notes from Sprockets 3.x to 4.x at https://github.com/rails/sprockets/blob/master/UPGRADING.md | |||
|
|||
- Fix `Sprockets::Server` to return response headers to compatible with with Rack::Lint 2.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a reverting of the lower case headers which caused a performance issue - but this was resolved in rack 2.2.4 according to #746 (comment)
I think this will have the same issues as the commit that was reverted. If Sprockets want to support both Rack 2 and 3 then it will need to be able to handle both Case-Sensitive and downcase only headers. |
Rack 2 has case insensitive headers so the downcase headers should be should still be valid. The issue that caused the regression was a bug in rack that was resolved by rack/rack#1919. We may wish to lock rack to >= 2.2.4 (which I have added)- but I think that may be overly restrictive as I think it was only a performance regression in test (and maybe dev) - but not production. Not sure if this (either changing the case of headers that may be accessed elsewhere, or the restriction of rack versions) could be considered a breaking change. |
Rack fixed one instance of the issue, but as long as Sprockets claims compatability with Rack 2 it needs to work with any other library that supports Rack 2. I believe the casing of the headers needs to be dependent on the version of Rack, since we can't assume other libraries will have already updated. |
I do not think that this is correct. Any library using Rack 2 could make any assumptions about the case of the header that it likes - so maybe sprockets is already incompatible with existing Rack 2 middleware. I think it is reasonable it argue that this could be considered a breaking change and that we need to bump the major version of sprockets - so that app maintainers would know to check for any incompatibilities - but it should still be able to support both Rack 2 and 3 using the lower case headers. The decision to bump the major version is something that I will leave to the maintainers of the project and I will not presume what they would consider a breaking change. |
Yeah, this patch is fine since sprockets will require the version of rack to the update to 2.2.4 which allow headers to be head with both cases. |
Thanks everyone! |
There's a user reported issue on Rack 2.2.6 that seems related to this, could someone take a look? rails/rails#47096 |
Add support for rack 3 by relaxing the version constraints and downcasing all of the headers.
Fixes #753