spdy-http2 / spdy-transport

SPDY v2, v3, v3.1 and HTTP2 transport implementation for node.js
101 stars 37 forks source link

Defer push response headers in http2 #36

Open BernzSed opened 7 years ago

BernzSed commented 7 years ago

Thanks for giving us such an awesome node module!

In HTTP/2, the response headers and status code for a pushed resource shouldn't have to be sent immediately. It would be very useful if we had the option to defer sending the response headers and status code, giving us the chance to fetch them from another server along with the response body.

The relevant code seems to be in http2/framer.js, in pushFrame(), in the callback to _checkPush. The status code and response headers are compressed and sent immediately.

sebdeckers commented 7 years ago

I would also like to see the push API changed to return a transport.Stream in the reserved state, before the response's HEADERS frame is sent. This would match the other implementations: