I'm trying to use PHP cURL HTTP Pipelining feature to perform multiple requests through single TCP connection. Refers to this page http://www.php.net/manual/en/function.curl-multi-setopt.php I'm enabling pipleining for curl_multi_exec() by adding:
curl_multi_setopt($mh, CURLMOPT_PIPELINING, 1);
I don't want to post a big source listing here, but you can easily view or checkout the full example from my github here https://github.com/anovikov1984/pipelining-example
For monitoring TCP connections I use 'netstat -t -u -c' command in another console session.
In my repo that I mentioned above there are two scripts. One for Ruby and one for PHP. The Ruby version works as wanted and opens only single TCP connection for 3 GET requests. But the PHP cURL version opens as many TCP connection as the number of cURL handles passed to curl_multi_exec() function.
What am i doing wrong?
It looks like this may be a bug in PHP's implementation of curl_multi_* with PIPELINING. It appears they may not expose all the CONSTANTS necessary to enable a developer to dictate how curl behaves on a multi-request when using PIPELINING.
I've submitted the bug report here: https://bugs.php.net/bug.php?id=68449
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With