Hi,

I've been poking around at HTTP/2 a lot lately, and it seems that so long
as you are using libcurl 7.43.0+ it's possible to do request multiplexing.

This change simply introduces three constants, CURLPIPE_NOTHING (0),
CURLPIPE_HTTP1 (1), and CURLPIPE_MULTIPLEX (2) which represent possible
values passed into curl_multi_setopt() for the CURLMOPT_PIPELINING option.
Current behavior of passing in 0 and 1 map to the first two constants,
while the third allows for multiplexing.

Now, of course, being constants, you can just pass in 0, 1, or 2, but this
brings the consistency and explicitness of exposing them as with all the
other curl constants.

I'd love to see this make it into PHP 7.0 if it's not too late? It's
extremely trivial, but whatever — not that fussed :)

PR is here: https://github.com/php/php-src/pull/1497

I'm not sure if there is some way to ensure that libcurl is compiled with
nghttp, but we don't check for the other HTTP/2 stuff so either it's done
elsewhere and I missed it, or we're making assumptions that the right
version is enough. Any input on this would be good.

FTR, multiplexing can bring substantial performance improvements,
especially when factoring in SSL:

379 HTTP SSL requests

Using HTTP/2 in serial: 63.293796062469 (HTTP/1.1 in serial should be even
slower)
Using HTTP/1.1 with curl_multi: 12.383034944534
Using HTTP/2 w/multiplexing: 2.7933928966522

Thanks,

- Davey

Reply via email to