How to send PHP cURL descriptors through a single TCP socket using an HTTP pipeline?

I am trying to use PHP CURL HTTP Pipelining to execute multiple requests over a single TCP connection. Applies to this page http://www.php.net/manual/en/function.curl-multi-setopt.php I enable pipleining for curl_multi_exec () by adding:

curl_multi_setopt ($ mh, CURLMOPT_PIPELINING, 1);

I don’t want to publish a large list of sources here, but you can easily view or check the full example from my github here https://github.com/anovikov1984/pipelining-example

To control TCP connections, I use the netstat -t -u -c command in another console session.

There are two scenarios in my repo that I mentioned above. One for Ruby and one for PHP. The Ruby version works as desired and opens only one TCP connection for 3 GET requests. But the PHP version of cURL opens as many TCP connections as the number of cURL processes passed to curl_multi_exec ().

What am I doing wrong?

+4
source share
1 answer

It looks like this might be a bug in the PHP implementation of curl_multi_ * with PIPELINING. It seems that they cannot provide all the CONSTANTS necessary for the developer to be able to determine how curl behaves in multi-protocol use when using PIPELINING.

: https://bugs.php.net/bug.php?id=68449

+1

Source: https://habr.com/ru/post/1547340/


All Articles