[ANNOUNCE] ngx_echo v0.28: support for the -n and -- options

agentzh agentzh at gmail.com
Mon May 3 13:45:00 MSD 2010

Hi, folks!

I'm happy to announce the v0.28 release of our ngx_echo module:


Ngx_echo is a powerful nginx module that wraps lots of Nginx internal
APIs for streaming input and output, parallel/sequential subrequests,
timers and sleeping, as well as various meta data accessing. Basically
it provides various utilities that help testing and debugging of other
modules by trivially emulating different kinds of faked subrequest

The highlight of this version is the introduction of new options "-n"
and "--" for the "echo", "echo_before_body", and "echo_after_body"

Now we can suppress the trailing newline character in the "echo"
output by using the -n option, as in

    location /echo {
        echo -n "hello, ";
        echo "world";

Accessing /echo gives

    $ curl 'http://localhost/echo'
    hello, world

Leading -n in variable values won't take effect and will be emitted
literally, as in

    location /echo {
        set $opt -n;
        echo $opt "hello, ";
        echo "world";

This gives the following output

    $ curl 'http://localhost/echo'
    -n hello, world

One can also output leading -n literals and other options using the
special -- option like this

    location /echo {
        echo -- -n is an option;

which yields

    $ curl 'http://localhost/echo'
    -n is an option

Please see the documentation for more details:


I must thank Dylan Stamat and kindy for prompting me to add the -n
option. They have even provided patches on their own but their patches
required more treatment before merging into the mainstream :)

In the next release, i.e., v0.29, I'll refactor the implementation of
the echo_location, echo_subrequest, and echo_sleep as promised in
another thread of this list.


More information about the nginx mailing list