Hey all,

In the PR for adding HTTP/2 Server Push support to curl, Julien raises the
question of adding tests for this feature [1].

This is currently very difficult.

While we have the cli-server, it currently only supports HTTP/1.x. This
means we need another httpd to test against that supports both HTTP/2 and
server push — currently that means something like a node script using
node-http2, or nghttpd (both of which have been what I tested the patch
against).

While I have a docker container for testing, this obviously doesn't fit
well into `make tests`. The simplest solution along those lines is to check
for `node` and run a node daemon, but it doesn't scale well to lots of use
cases, and is purely for testing.

However, Rasmus raised the possibility of adding HTTP/2 support to the
cli-server [2], and (someone? @php-pulls) suggested we pull in a third
party lib to do the heavy lifting [3].

My recommendation would be to use libnghttp2 [4] which curl also uses —
however, as this adds a new dependency, I think it should be optional (e.g.
--with-nghttp2-dir=[PATH]), with it falling back to the current HTTP/1.x
implementation.

We could also add a flag (e.g. --[no-]http2) on the CLI for
enabling/disabling it — this would be helpful for testing HTTP/2 client
fallback when it's not supported.

This is a much more useful tool than relying on node for make tests, and
allows us to test adding HTTP/2 support to ext/curl, the HTTP stream (which
could also use libnghttp2…), userland HTTP/2 clients, pecl_http (if that's
still a thing), etc.

Now, I don't think I have the ability to achieve this, but I'm willing to
give it a go.

At the very least, I'm more than happy to write up the RFC and work with
someone on this.

Thoughts?

- Davey

[1] https://github.com/php/php-src/pull/1692#issuecomment-166935246
[2] https://github.com/php/php-src/pull/1692#issuecomment-166972540
[3] https://github.com/php/php-src/pull/1692#issuecomment-166997465
[4] https://nghttp2.org

Reply via email to