|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-03-27 07:40 UTC] mike@php.net
-Status: Open
+Status: Verified
-Assigned To:
+Assigned To: mike
[2015-03-27 09:16 UTC] mike@php.net
[2015-03-27 09:16 UTC] mike@php.net
-Status: Verified
+Status: Closed
[2015-03-27 09:18 UTC] php at qzxj dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 18:00:01 2025 UTC |
Description: ------------ pecl_http doesn't work properly when sending a GET request with a body. The server hangs for about 10 seconds once send() is called. It looks like the Content-Length is getting sent but the request body is not, so apache is hanging waiting for the body to be sent but it never comes. Curl command line works: $ curl -X GET localhost/test.php -d 'hello' GET application/x-www-form-urlencoded, 3 bytes: foo But my demo script doesn't: $ php demo.php GET text/plain, 3 bytes: Test script: --------------- <?php // http://localhost/test.php echo "{$_SERVER['REQUEST_METHOD']} ". "{$_SERVER['CONTENT_TYPE']}, {$_SERVER['CONTENT_LENGTH']} bytes: ". file_get_contents('php://input')."\n"; // demo.php $c = new \http\Client; $r = new \http\Request( 'GET', 'http://localhost/test.php', ['Content-Type'=>'text/plain'], (new \http\Message\Body)->append('foo') ); $s = microtime(true); $rs = $c->enqueue($r)->send()->getResponse(); $t = microtime(true) - $s; echo "Took $t seconds\n"; echo $rs->getBody()."";