Reorder output chain when subrequests are used
dakota at brokenpipe.ru
Sun May 5 21:08:09 UTC 2013
That's helped. Although, I'm not quite sure that I completely understand
what I've done. But it is working as expected now.
On Sat, May 4, 2013 at 10:42 PM, agentzh <agentzh at gmail.com> wrote:
> On Fri, May 3, 2013 at 3:28 PM, Marat Dakota wrote:
> > Ok, I need improper way then. Just some way.
> > The problem is that I know "bbb" only after the subrequest is made. And
> > subrequest's body is being completely filtered by body filter. So, in
> fact I
> > will not have "ccc", just "aaabbb", but I can't flush "bbb" out because
> > waits for the subrequest to be done.
> Well, I ran into this problem while working on the "light thread"
> model  for my ngx_lua module months ago.
> The default Nginx subrequest setup ensures the output order by means
> of ngx_http_postpone_filter_module and r->postponed. So we need
> workarounds here.
> The solution I end up with is to write my own version of the
> ngx_http_subrequest function in ngx_lua and temporarily switch the
> current active request (i.e., r->connection->data) to the parent
> request every time the parent request is trying to output something
> when there's still pending subrequests running (so as to bypass
> ngx_http_postpone_filter_module). This works pretty well.
> You can check out the ngx_lua module's source for more details
> especially the file src/ngx_http_lua_subrequest.c.
> Among other things, maybe you want to consider directly using ngx_lua
> instead of writing your own Nginx C module for this task.
> Best regards,
>  http://wiki.nginx.org/HttpLuaModule#ngx.thread.spawn
> nginx-devel mailing list
> nginx-devel at nginx.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the nginx-devel