I have been looking into ways to use HTTP/2's pushing features, in order to reduce the number of issued GET requests and the average perceived delay in specific client-server implementations. The existing client heavily relies on the use of curl to issue GET requests, and I need to be able to reuse the current implementation. Recent versions of curl provide support for HTTP/2, relying on the underlying nghttp2 module. Using the existing nghttp2 server:
nghttpd -d /var/www/html/ 3000 local.key local.crt
both nghttp and curl can be used to get an example text file's content:
nghttp https://localhost:3000/text.txt
This is some sample text.
curl https://localhost:3000/text.txt -k --http2
This is some sample text.
Using nghttp2's pushing feature however, where another text file is pushed along:
nghttpd -d /var/www/html/ -p/text.txt=/text2.txt 3000 local.key local.crt
curl seems not capable of dealing with the pushed resource:
nghttp https://localhost:3000/bbb/text.txt
This is some sample text.
This is some sample text as well.
curl https://localhost:3000/text.txt -k --http2 -v
...
* nghttp2_session_mem_recv() returns 268
* before_frame_send() was called
* on_frame_send() was called
* on_stream_close() was called, error_code = 1
* before_frame_send() was called
* on_frame_send() was called
* on_stream_close() was called, error_code = 1
* Connection #0 to host localhost left intact
Indeed, at server side, two resets are received for the two opened streams:
[id=1] [331.593] recv RST_STREAM frame <length=4, flags=0x00, stream_id=1>
(error_code=PROTOCOL_ERROR(0x01))
[id=1] [331.594] recv RST_STREAM frame <length=4, flags=0x00, stream_id=2>
(error_code=PROTOCOL_ERROR(0x01))
[id=1] [331.594] closed
Is there a way to use curl with the HTTP/2 pushing features?
curl
support the HTTP/2 push as of today? – Ginetteginevra