diff options
author | Andrew Clayton <a.clayton@nginx.com> | 2023-10-23 14:24:01 +0100 |
---|---|---|
committer | Andrew Clayton <a.clayton@nginx.com> | 2023-12-08 13:48:33 +0000 |
commit | d9f5f1fb741109cc232cedd3574aa587626789c1 (patch) | |
tree | 4f6cc38617b11d85b9f81e3f30a1ab1938b1a353 /src/nxt_port_queue.h | |
parent | 846a7f483643a00322f81a7848ca556722e5469a (diff) | |
download | unit-d9f5f1fb741109cc232cedd3574aa587626789c1.tar.gz unit-d9f5f1fb741109cc232cedd3574aa587626789c1.tar.bz2 |
Ruby: Handle response field arrays
@xeron on GitHub reported an issue whereby with a Rails 7.1 application
they were getting the following error
2023/10/22 20:57:28 [error] 56#56 [unit] #8: Ruby: Wrong header entry 'value' from application
2023/10/22 20:57:28 [error] 56#56 [unit] #8: Ruby: Failed to run ruby script
After some back and forth debugging it turns out rack was trying to send
back a header comprised of an array of values. E.g
app = Proc.new do |env|
["200", {
"Content-Type" => "text/plain",
"X-Array-Header" => ["Item-1", "Item-2"],
}, ["Hello World\n"]]
end
run app
It seems this became a possibility in rack v3.0[0]
So along with a header value type of T_STRING we need to also allow
T_ARRAY.
If we get a T_ARRAY we need to build up the header field using the given
values.
E.g
"X-Array-Header" => ["Item-1", "", "Item-3", "Item-4"],
becomes
X-Array-Header: Item-1; ; Item-3; Item-4
[0]: <https://github.com/rack/rack/blob/main/UPGRADE-GUIDE.md?plain=1#L26>
Reported-by: Ivan Larionov <xeron.oskom@gmail.com>
Closes: <https://github.com/nginx/unit/issues/974>
Link: <https://github.com/nginx/unit/pull/998>
Tested-by: Timo Stark <t.stark@nginx.com>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'src/nxt_port_queue.h')
0 files changed, 0 insertions, 0 deletions