Parallel subrequests for multi-source long polling?

shaun nginx-forum at
Fri Nov 20 11:33:15 MSK 2009

Piotr Sikora Wrote:
> > I figure the trickiest part will be building
> those requests and getting 
> > them in to state that's usable by nginx.
> This is already done, so there isn't much to
> figure out ;)
> Just create "independent" request:
> r = ngx_supervisord_init(pool, uscf);
> and then you can inject it into regular nginx's
> flow:
> ngx_http_upstream_init(r);
> You just need to create your own u->peer.get(),
> u->, 
> u->create_request() and u->finalize_request()
> functions.
> That's of course, if you give up on subrequests.
> Best regards,
> Piotr Sikora < piotr.sikora at >

Awesome, I got it fully working using this method.  I gave up my battle against the subrequests and switched over to creating new requests in the same manner as your supervisord module.  There's a bit more trickiness needed, since these new requests will need some of the pieces of the original request (some of  the original request's configuration, headers and server variables in my case).

I don't have the headers working completely correctly yet, but everything else seems to work perfectly.

I might be able to package this up as a generic subrequest replacement.  At the very least, I'll clean up the code and post it somewhere for everyone's perusal.

Thanks a bunch to both of you (Piotr and Agentzh) for your help.


Posted at Nginx Forum:,23767,24347#msg-24347

More information about the nginx mailing list