Skip to content

Support array response headers in CGI - #41

Open
OskarEichler wants to merge 2 commits into
rack:mainfrom
OskarEichler:songstats/cgi-array-response-headers
Open

Support array response headers in CGI#41
OskarEichler wants to merge 2 commits into
rack:mainfrom
OskarEichler:songstats/cgi-array-response-headers

Conversation

@OskarEichler

Copy link
Copy Markdown

Rack 3 permits response header values to be either a String or an Array of Strings. The CGI handler calls split directly on every value, so it raises NoMethodError for a conforming array value such as multiple set-cookie headers.

Wrap each value with Array(...), emit every item separately, and retain the existing newline splitting for legacy String values.

Verification:

  • deterministic CGI model fails on 2.3.1/current and passes this branch
  • full suite: 76 runs / 194 assertions / 0 failures
  • Ruby syntax, warning-mode load, package build and diff checks pass on Ruby 4.0.6
  • combined candidate also passes 74 runs / 182 assertions on Ruby 3.2.11

No breaking API change.

@ioquatix

Copy link
Copy Markdown
Member

It may be good to include a test that would otherwise fail.

@OskarEichler

Copy link
Copy Markdown
Author

Added a CGI regression covering an array-valued set-cookie header while retaining the existing newline-splitting behavior for String values. The focused test and full local suite pass: 75 runs, 179 assertions, 0 failures. I also checked the failing external CI job: the rackup tests pass there; it fails later because current Falcon now requires Ruby 3.3 while that external job runs Ruby 3.2, so it is unrelated to this change.

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.

2 participants