Skip to content

Commit

Permalink
added echo_before_body and echo_after_body to the directive list in R…
Browse files Browse the repository at this point in the history
…EADME.
  • Loading branch information
agentzh committed Oct 16, 2009
1 parent edfd63f commit 15366e2
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
24 changes: 22 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,28 @@ This is a sample configuration snippet in your nginx.conf file:
echo_sleep 0.02;
echo "$echo_timer_elapsed sec elapsed.";
}

location /filtered {
echo_before_body hello;
echo_before_body world;
proxy_pass http://127.0.0.1:$server_port$request_uri/more;
echo_after_body hiya;
echo_after_body igor;
}
location /filtered/more {
echo more...;
}

...
}
...
}

As you can see, the directives currently provided by this module are
"echo", "echo_client_request_headers", "echo_sleep", "echo_flush",
and "echo_reset_timer". And there's also an "echo_blocking_sleep"
directive for completeness.
"echo_reset_timer", "echo_before_body", and "echo_after_body".

And there's also an "echo_blocking_sleep" directive for completeness.

The "echo_sleep" directive is a non-blocking sleep on the server side. So if your
nginx worker process is "sleeping" for one request, it could serve other requests
Expand Down Expand Up @@ -114,6 +127,13 @@ After starting the nginx server, one can query it these ways:
0.032 sec elapsed.
0.020 sec elapsed.

$ curl 'http://localhost:8080/filtered'
hello
world
more...
hiya
igor

Variables

This module implements the $echo_timer_elapsed variable.
Expand Down
25 changes: 24 additions & 1 deletion test/t/echo-after-body.t
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ hello
--- config
location /echo {
echo_after_body hello;
proxy_pass $request_uri/more;
proxy_pass http://127.0.0.1:$server_port$request_uri/more;
}
location /echo/more {
echo world
Expand Down Expand Up @@ -135,3 +135,26 @@ hiya
world
igor
=== TEST 2: echo around proxy
--- config
location /echo {
echo_before_body hello;
echo_before_body world;
#echo $scheme://$host:$server_port$request_uri/more;
proxy_pass $scheme://127.0.0.1:$server_port$request_uri/more;
echo_after_body hiya;
echo_after_body igor;
}
location /echo/more {
echo blah;
}
--- request
GET /echo
--- response_body
hello
world
blah
hiya
igor

0 comments on commit 15366e2

Please sign in to comment.