Communications Sequence with Upstream
agentzh
agentzh at gmail.com
Mon Apr 26 15:43:19 MSD 2010
On Mon, Apr 26, 2010 at 6:33 PM, Magnus Lynch <maglyx at gmail.com> wrote:
> On Sun, Apr 25, 2010 at 2:35 AM, agentzh <agentzh at gmail.com> wrote:
>
> Thanks. I looked over echo_location. It uses ngx_http_subrequest,
> which I had gathered to be limited to concatenating responses
> together, and it still appears that way to me. It appears there's no
> hook for you to deal with the data the subrequest produces, as the
> various filter hooks the upstream support provides.
>
And that's way I said "echo_location" does not expose the full power
of nginx subrequests. We can use filters to capture all the outputs of
subrequests, as be done in my fork of ngx_eval module:
http://github.com/agentzh/nginx-eval-module
We'll use this trick again in our ngx_lua's ngx.subrequest.capture
implementation.
> I'm interested in a more general ability to:
> handler sends arbitrary message x_1, response y_1 comes back, ...
> repeat n times. handler sends response f(y_1, ..., y_n) to original
> query, f an arbitrary function--which is to say I want to have the
> responses passed through a filter of mine as they're generated, not
> sent straight to the client.
>
Sure you can do that. That's the way to go ;)
> Maybe I'll have to write my own code from scratch for dealing with this.
>
Indeed :)
BTW, I looked over the related code in ngx_echo which was written 5
months ago and found that it does not get r->main->count right for
nginx 0.8.x >= 0.8.11. I'll rewrite the main dispatcher and the
related parts for echo_location, echo_subrequest, and echo_sleep in
the next day or two and make a new release.
I apologize for not updating the ngx_echo codebase in time. People who
have copied the current implementation of
echo_subrequest/echo_location should update their code according to
the next release of ngx_echo. I'm sorry :P
Cheers,
-agentzh
More information about the nginx
mailing list