I was looking for ways to use the push / push push / push functions to reduce the number of GET requests issued and the average perceived delay in specific client-server implementations. The existing client relies heavily on using curl to issue GET requests, and I need to be able to reuse the current implementation. Recent curl versions provide HTTP / 2 support based on the nghttp2 core module. Using an 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:
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 the pushghth2 function, however, when you press another text file:
nghttpd -d /var/www/html/ -p/text.txt=/text2.txt 3000 local.key local.crt
curl does not seem to be able to handle the pressed 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
Indeed, on the server side, two flushes are accepted for two open threads:
[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 HTTP / 2 push search functions?
source share