Skip to content

1.2: backport minor Rack 2.2-era spec compatibility fixes - #479

Merged
chadlwilson merged 5 commits into
jruby:1.2-stablefrom
chadlwilson:1.2-backport-fixes
Sep 8, 2026
Merged

chadlwilson merged 5 commits into
jruby:1.2-stablefrom
chadlwilson:1.2-backport-fixes

Conversation

@chadlwilson

Copy link
Copy Markdown
Contributor

Fixes a handful of smaller spec compatiibility issues detected for Rack 3.x which also apply to Rack 2.2

Every bodyless error response returned (and mutated) the same Hash
object stored in the DEFAULT_HEADERS constant, so headers set for one
response leaked into all subsequent error responses.
read(0) fell into the read-everything path (readUntil treats a zero
count as unlimited) and consumed the whole input stream, instead of
returning "" like IO#read as the Rack SPEC describes.
The Rack SPEC requires the original body to be closed (if it responds
to close) whenever it is replaced - the rendered error template was
dropping custom error app bodies without closing them.
Rack does not mandate response header name casing (and Rack 3.x apps
lower-case them), yet the chunked detection, the chunked-header strip
and the flush-on-no-content-length logic only matched the conventional
Capitalized-Names - a lower-case header silently bypassed them.
@chadlwilson
chadlwilson merged commit 8068027 into jruby:1.2-stable Sep 8, 2026
101 checks passed
@chadlwilson
chadlwilson deleted the 1.2-backport-fixes branch September 8, 2026 05:27
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.

1 participant