You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your software version (Screenshot of your startup)
Software
Version
PHP
7.4.14
Swoole
4.5.9
Laravel/Lumen
8.26.1
Detail description about this issue(error/log)
Laravel supports multiple response headers with the same name (as per HTTP standard). It is achieved by calling HeaderBag::set() with an array as a second argument, something like:
$request->headers->set('trailer', ['a', 'b']);
This is accounted for in LaravelS, i.e. it iterates over all header values and calls Swoole\Http\Response::header() method. However, this usage is incorrect, according to the Swoole documentation, namely:
重复设置相同 $key 的 HTTP 头会覆盖,取最后一次
which Google Translate helped me with:
repeating the same set of $key HTTP head Will overwrite, take the last
i.e., in normal words, only the last value will be preserved.
filakhtov
changed the title
Invalid conversion between Laravel headers and Swoole headers
Invalid conversion between multiple Laravel headers and Swoole headers
Feb 18, 2021
Swoole (<4.6.0) does not support setting the header key with the same name,
LaravelS supports it now, but you need to upgrade Swoole to 4.6.x.
A new version of LaravelS will be released in the next few days.
Thank you very much! We have finally got around to properly testing it, as we were blocked by swoole/swoole-src#4133 when we first tried everything together, but once Swoole actually addressed their issue everything is working properly now!
Your software version (Screenshot of your startup)
Detail description about this issue(error/log)
Laravel supports multiple response headers with the same name (as per HTTP standard). It is achieved by calling
HeaderBag::set()
with an array as a second argument, something like:This is accounted for in LaravelS, i.e. it iterates over all header values and calls
Swoole\Http\Response::header()
method. However, this usage is incorrect, according to the Swoole documentation, namely:which Google Translate helped me with:
i.e., in normal words, only the last value will be preserved.
reproducible
code blocks andsteps
When this snippet put into any controller the result will be:
but the expected outcome should have multiple
X-My-Header
headers.Perhaps, we should look at header folding? Or is that something for Swoole to enable support for?
The text was updated successfully, but these errors were encountered: