php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69313 http\Client doesn't send GET body
Submitted: 2015-03-27 00:55 UTC Modified: 2015-03-27 07:40 UTC
From: php at qzxj dot net Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5.6.7 OS: Ubuntu 14.10 64-bit
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at qzxj dot net
New email:
PHP Version: OS:

 

 [2015-03-27 00:55 UTC] php at qzxj dot net
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()."";



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [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
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=pecl/http/pecl_http.git;a=commit;h=f95804b9731a37187624208a1e2f720da373a989
Log: Fixed bug #69313
 [2015-03-27 09:16 UTC] mike@php.net
-Status: Verified +Status: Closed
 [2015-03-27 09:18 UTC] php at qzxj dot net
Amazing! Thanks for the super-fast turnaround!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 02:01:27 2024 UTC