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
Please answer these questions before submitting your issue. Thanks!
What did you do? If possible, provide a simple script for reproducing the error.
Swoole\Coroutine::create(function () {
// the target server can response "Expect: 100-continue" correctly, for example nginx$http = new \Swoole\Coroutine\Http\Client($host, $port);
$http->setMethod('POST');
$http->setHeaders([
'Content-type' => 'application/json',
"Expect" => '100-continue',
]);
$http->setData(\json_encode(['id' => 0]));
$http->execute('/test_api'); // the request will block for a long timevar_dump($http);
});
If requesting without header "Expect: 100-continue", the response will be parse correctly
And request via curl is correct:
curl -H "Content-type: application/json" -H "Expect: 100-continue" -X POST -d '{"id":100}' http://host/test -v
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 192.168.10.10...
* TCP_NODELAY set
* Connected to host (192.168.10.10) port 80 (#0)
> POST /test HTTP/1.1
> Host: larabbs.test
> User-Agent: curl/7.54.0
> Accept: */*
> Content-type: application/json
> Expect: 100-continue
> Content-Length: 10
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Server: nginx/1.15.8
< Content-Type: application/json
< Transfer-Encoding: chunked
< Connection: keep-alive
< Cache-Control: no-cache, private
< Date: Thu, 07 May 2020 07:26:16 GMT
<
* Connection #0 to host xxx.xxx left intact
{"data":"","code":0}
What version of Swoole are you using (show your php --ri swoole)?
swoole
Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 4.4.6
Built => Sep 22 2019 23:36:25
coroutine => enabled
kqueue => enabled
rwlock => enabled
http2 => enabled
pcre => enabled
zlib => enabled
brotli => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => Off => Off
swoole.unixsock_buffer_size => 262144 => 262144
What is your machine environment used (including version of kernel & php & gcc) ?
PHP 7.3.5 (cli) (built: May 2 2019 12:40:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.5, Copyright (c) 1999-2018, by Zend Technologies
The text was updated successfully, but these errors were encountered:
Please answer these questions before submitting your issue. Thanks!
the print result:
the print result:
If requesting without header "Expect: 100-continue", the response will be parse correctly
And request via curl is correct:
php --ri swoole
)?The text was updated successfully, but these errors were encountered: