diff options
author | Jeremy Evans <code@jeremyevans.net> | 2022-02-02 16:19:59 -0800 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2022-02-02 16:19:59 -0800 |
commit | 79328deacf599b92c82b9e38aced48033f3f4d2f (patch) | |
tree | 7947351ec70b2d2ef7e291dd922e8dd2f99284e7 /CHANGELOG.md | |
parent | 568dee5a2de80a9da20e2baf084b215abeee4ea8 (diff) | |
download | rack-79328deacf599b92c82b9e38aced48033f3f4d2f.tar.gz |
Add Rack::Headers to support lower-case header keys
This implements a Hash subclass that lower-cases keys passed to it.
The expected usage is for Rack 2 libraries/frameworks that want to be
compatible with Rack 3, assuming that we require response header
keys to be lower-case in Rack 3 (as discussed in #1592).
I've tested this implementation in Roda (a web framework), and only
minimal changes were needed to get Roda's tests passing with it,
even though Roda uses mixed-case headers throughout its implementation
and tests. It was simple to get the tests passing both with the
implementation and without, showing that it's possible to get a
framework that can support both Rack 2 and Rack 3.
Additionally, I tested Rodauth (an authentication framework built on
top of Roda), with the modified version of Roda, and again, only
minimal changes were needed to keep the tests passing.
I also tested a handful of small applications based on Roda using the
modified version of Roda, and none of those applications needed any
changes to keep their tests passing. I think that shows that
requiring lower-case response header keys is probably acceptable,
since it should result in minimal if any churn to applications, and
only minor churn to libraries.
The implementation of Rack::Headers is based on ruby-cicphash
(a case-insensitive, case-preserving hash implementation),
but streamlined as case doesn't need to be preserved, and it
is a Hash subclass (as required by Rack 3 SPEC), instead of
an Object subclass that uses a hash internally.
Diffstat (limited to 'CHANGELOG.md')
-rw-r--r-- | CHANGELOG.md | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 67a0a27b..176a2be7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file. For info on ### Added +- `Rack::Headers` added to support lower-case header keys. ([@jeremyevans](https://github.com/jeremyevans)) - `Rack::RewindableInput` supports size. ([@ahorek](https://github.com/ahorek)) - Rack::Session::Pool now accepts `:allow_fallback` option to disable fallback to public id. ([#1431](https://github.com/rack/rack/issues/1431), [@jeremyevans](https://github.com/jeremyevans)) |