Skip to content

Commit

Permalink
refactored the repo and updated README to reflect new features of echo
Browse files Browse the repository at this point in the history
  • Loading branch information
agentz authored and agentzh committed Oct 4, 2009
1 parent c39f826 commit 8ca0641
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -10,3 +10,4 @@ print.txt
.rsync
*.tar.gz
dist
build.sh
14 changes: 10 additions & 4 deletions README
@@ -1,6 +1,6 @@
Description

A simple echo-back nginx module for inspecting the actual HTTP requests issued by an HTTP client
An nginx module for bringing the power of sh's "echo" command to Nginx's config file.

Installation

Expand All @@ -21,8 +21,11 @@ This is a sample configuration snippet in your nginx.conf file:
...
server {
...
location /echo {
echo;
location /echoback {
echo_client_request_header;
}
location /hello {
echo 'hello, world';
}
...
}
Expand All @@ -34,12 +37,15 @@ As you can see, the only directive provided by this module is

After starting the nginx server, one can query it this way:

$ curl 'http://localhost/echo'
$ curl 'http://localhost/echoback'
GET /echo HTTP/1.1
User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.10
Host: localhost
Accept: */*

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

Contact the author by agentzh at gmail dot com whenever you have
any questions.

2 changes: 1 addition & 1 deletion config
@@ -1,4 +1,4 @@
ngx_addon_name=ngx_http_echo_module
HTTP_MODULES="$HTTP_MODULES ngx_http_echo_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_echo_module.c"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_http_echo_module.c"

4 changes: 3 additions & 1 deletion ngx_http_echo_module.c → src/ngx_http_echo_module.c
@@ -1,4 +1,4 @@
#define DDEBUG 1
#define DDEBUG 0

#include <ngx_config.h>
#include <ngx_core.h>
Expand All @@ -7,6 +7,8 @@

#if (DDEBUG)
#include <ddebug.h>
#else
#define DD
#endif

static char *ngx_http_echo(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
Expand Down

0 comments on commit 8ca0641

Please sign in to comment.