Make ngx_http_v2_push_resource api public

Maxim Dounin mdounin at mdounin.ru
Tue Nov 13 17:10:20 UTC 2018


Hello!

On Mon, Nov 12, 2018 at 10:29:50PM -0500, Cubic wrote:

> I am intend to write an Nginx module which support downstream message push
> through http2 protocol.
> 
> The main process is as below.
> 1. Client connect to Nginx and use http2 protocol to send a long polling
> request stream.
> 2. Nginx hold this long polling request stream and wait downstream
> messages.
> 3. If a message arrival, Nginx could send a push promise through the long
> polling stream and put the message in another stream associated with the
> push promise
> 
> There is an ngx_http_v2_push_resource api in ngx_http_v2_filter_module.c
> which assemble push promise frame and create another stream to invoke an
> internal request by the specific path to send data, so i can register an
> content handler with that path to send the message.
> But sadly, this api is static somehow.
> 
> Would you make this amazing api public?

Similar request was previously rejected, see this thread for 
details:

http://mailman.nginx.org/pipermail/nginx-devel/2018-February/010847.html

In short: this API is not going to be public.  If you want to push 
resources from your module, consider using the "http2_push" 
directive with a variable, or using the "Link: rel=preload" header.

As for the design you describe, it looks unnecessarily 
HTTP/2-centric.  You may want to consider returning an actual 
response to the long polling request instead of trying to maintain 
a fake request and return associated pushed resources.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list