Memcached/JSONP

Marcus Clyne ngx.eugaia at gmail.com
Wed Dec 23 00:36:13 MSK 2009


Hi,

dylanz wrote:
> I noticed that "echo" isn't outputting on non-async events, for example:
>
>
> echo "before";
> set $memcached_key $uri;
> memcached_pass 127.0.0.1:11211;
> echo "after";
>   
This should be

location  /first {
    echo   "before";
    echo_location_aysnc  /second;    (or echo_location  /second)
    echo  "after"
}

location    /second {
    set   $memcached_key   $uri;
    memcached_pass   127.0.0.1;
}

The reason is to do with how the internals of Nginx work.  Everything 
that has echo_XXX should follow in order.  If you try mixing echo_xxx 
statements with other directives, you'll likely get *interesting* results.
>
> That results in the contents of the memcached_pass, but doesn't include the echo output.
> I tried throwing in some echo_flush commands to see if that would help, but it didn't.
> However, it does work if I use the after/before echo commands, for example:
>
>
> echo_before_body "before";
> set $memcached_key $uri;
> memcached_pass 127.0.0.1:11211;
> echo_after_body "after";
>
>
> I added the -n flag option to echo.c, and it works when I'm not doing doing that proxy pass,
> for example, this:
>   
Cool.  If you haven't done so already, it might be useful to add it to 
any of the other echo_xxx directives that automatically add a newline 
(e.g. echo_before, echo_after ?) - if it's not too much trouble, of course.

Marcus.




More information about the nginx mailing list