That's helped. Although, I'm not quite sure that I completely understand what I've done. But it is working as expected now.
Thank you! -- Marat On Sat, May 4, 2013 at 10:42 PM, agentzh <[email protected]> wrote: > Hello! > > 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 > it > > waits for the subrequest to be done. > > > > Well, I ran into this problem while working on the "light thread" > model [1] 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 > > https://github.com/chaoslawful/lua-nginx-module > > 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, > -agentzh > > [1] http://wiki.nginx.org/HttpLuaModule#ngx.thread.spawn > > _______________________________________________ > nginx-devel mailing list > [email protected] > http://mailman.nginx.org/mailman/listinfo/nginx-devel >
_______________________________________________ nginx-devel mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx-devel
