We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please answer these questions before submitting your issue. Thanks!
This is related to a fix in LaravelS: hhxsv5/laravel-s#341
Based on https://wiki.swoole.com/#/http_server?id=setheader we try to use an array type for header values, but it emits an error under HTTP/2.
array
Test script (foo.php):
foo.php
<?php $http = new Swoole\Http\Server("127.0.0.1", 9501); $http->set(['open_http2_protocol' => true]); $http->on('request', function ($request, $response) { $response->header('Test-Value', [ "a\r\n", 'd5678', "e \n ", null, 5678, 3.1415926, ]); $response->end("<h1>Hello Swoole. #".rand(1000, 9999)."</h1>"); }); $http->start();
Multiple headers with no error, such as this:
$ curl -v http://localhost:9501 * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 9501 (#0) > GET / HTTP/1.1 > Host: localhost:9501 > User-Agent: curl/7.64.1 > Accept: */* > < HTTP/1.1 200 OK < Test-Value: a < Test-Value: d5678 < Test-Value: e < Test-Value: 5678 < Test-Value: 3.1415926 < Server: swoole-http-server < Connection: keep-alive < Content-Type: text/html < Date: Wed, 07 Apr 2021 06:55:36 GMT < Content-Length: 28 < * Connection #0 to host localhost left intact <h1>Hello Swoole. #8020</h1>* Closing connection 0
A single header with value Array:
Array
$ curl --http2-prior-knowledge -v http://localhost:9501 * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 9501 (#0) * Using HTTP2, server supports multi-use * Connection state changed (HTTP/2 confirmed) * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0 * Using Stream ID: 1 (easy handle 0x7fdc0e80d600) > GET / HTTP/2 > Host: localhost:9501 > User-Agent: curl/7.64.1 > Accept: */* > * Connection state changed (MAX_CONCURRENT_STREAMS == 128)! < HTTP/2 200 < test-value: Array < server: swoole-http-server < date: Wed, 07 Apr 2021 06:55:43 GMT < content-type: text/html < content-length: 28 < * Connection #0 to host localhost left intact <h1>Hello Swoole. #1940</h1>* Closing connection 0
And an error logged in the PHP console:
PHP Notice: Array to string conversion in $DIR/foo.php on line 16 Notice: Array to string conversion in $DIR/foo.php on line 16
php --ri swoole
4.6.3 and 4.6.4
uname -a
php -v
gcc -v
Darwin C02CN25XMD6P 19.6.0 Darwin Kernel Version 19.6.0: Sun Jul 5 00:43:10 PDT 2020; root:xnu-6153.141.1~9/RELEASE_X86_64 x86_64
PHP 7.4.16 (cli) (built: Mar 4 2021 20:49:25) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1 Apple clang version 12.0.0 (clang-1200.0.26.2) Target: x86_64-apple-darwin19.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Problem also exhibits in a separate Debian-based container environment.
The text was updated successfully, but these errors were encountered:
Allow array HTTP/2 headers, Bug fixed for #4133
f5b68fc
Allow array HTTP/2 headers, Bug fixed for #4133 (#4140)
46ea525
* Allow array HTTP/2 headers, Bug fixed for #4133 * Fix tests * Fix tests * Fix tests * optimize Co-authored-by: matyhtf <mikan.tenny@gmail.com>
Sorry, something went wrong.
No branches or pull requests
Please answer these questions before submitting your issue. Thanks!
This is related to a fix in LaravelS: hhxsv5/laravel-s#341
Based on https://wiki.swoole.com/#/http_server?id=setheader we try to use an
array
type for header values, but it emits an error under HTTP/2.Test script (
foo.php
):Multiple headers with no error, such as this:
A single header with value
Array
:And an error logged in the PHP console:
php --ri swoole
)?4.6.3 and 4.6.4
uname -a
&php -v
&gcc -v
) ?Darwin C02CN25XMD6P 19.6.0 Darwin Kernel Version 19.6.0: Sun Jul 5 00:43:10 PDT 2020; root:xnu-6153.141.1~9/RELEASE_X86_64 x86_64
PHP 7.4.16 (cli) (built: Mar 4 2021 20:49:25) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.26.2)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Problem also exhibits in a separate Debian-based container environment.
The text was updated successfully, but these errors were encountered: