Welcome! Log In Create A New Profile

Advanced

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

agentzh
May 03, 2010 05:48AM
Hi, folks!

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

http://github.com/agentzh/echo-nginx-module/tarball/v0.28

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
locations.

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

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:

http://wiki.nginx.org/NginxHttpEchoModule#echo

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.

Enjoy!
-agentzh

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

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

agentzh May 03, 2010 05:48AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 211
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready