GithubHelp home page GithubHelp logo

openresty / echo-nginx-module Goto Github PK

View Code? Open in Web Editor NEW
1.2K 1.2K 255.0 1.19 MB

An Nginx module for bringing the power of "echo", "sleep", "time" and more to Nginx's config file

Home Page: http://wiki.nginx.org/NginxHttpEchoModule

License: BSD 2-Clause "Simplified" License

C 95.98% Perl 2.50% Shell 1.52%

echo-nginx-module's Introduction

Name

OpenResty - Turning Nginx into a Full-Fledged Scriptable Web Platform

Table of Contents

Description

OpenResty is a full-fledged web application server by bundling the standard nginx core, lots of 3rd-party nginx modules, as well as most of their external dependencies.

This bundle is maintained by Yichun Zhang (agentzh).

Because most of the nginx modules are developed by the bundle maintainers, it can ensure that all these modules are played well together.

The bundled software components are copyrighted by the respective copyright holders.

The homepage for this project is on openresty.org.

For Users

Visit the download page on the openresty.org web site to download the latest bundle tarball, and follow the installation instructions in the installation page.

For Bundle Maintainers

The bundle's source is at the following git repository:

https://github.com/openresty/openresty

To reproduce the bundle tarball, just do

make

at the top of the bundle source tree.

Please note that you may need to install some extra dependencies, like perl, dos2unix, and mercurial. On Fedora 22, for example, installing the dependencies is as simple as running the following commands:

sudo dnf install perl dos2unix mercurial

Back to TOC

Additional Features

In additional to the standard nginx core features, this bundle also supports the following:

Back to TOC

resolv.conf parsing

syntax: resolver address ... [valid=time] [ipv6=on|off] [local=on|off|path]

default: -

context: http, stream, server, location

Similar to the resolver directive in standard nginx core with additional support for parsing additional resolvers from the resolv.conf file format.

When local=on, the standard path of /etc/resolv.conf will be used. You may also specify arbitrary path to be used for parsing, for example: local=/tmp/test.conf.

When local=off, parsing will be disabled (this is the default).

This feature is not available on Windows platforms.

Back to TOC

Mailing List

You're very welcome to join the English OpenResty mailing list hosted on Google Groups:

https://groups.google.com/group/openresty-en

The Chinese mailing list is here:

https://groups.google.com/group/openresty

Back to TOC

Report Bugs

You're very welcome to report issues on GitHub:

https://github.com/openresty/openresty/issues

Back to TOC

Copyright & License

The bundle itself is licensed under the 2-clause BSD license.

Copyright (c) 2011-2019, Yichun "agentzh" Zhang (章亦春) [email protected], OpenResty Inc.

This module is licensed under the terms of the BSD license.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Back to TOC

echo-nginx-module's People

Contributors

agentzh avatar anthonyryan1 avatar chipitsine avatar defanator avatar dobe avatar doujiang24 avatar mathieu-aubin avatar mrefish avatar piotrsikora avatar thibaultcha avatar xiaocang avatar zhuizhuhaomeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

echo-nginx-module's Issues

echo "-U" doesn't echo anything.

This configuration:
location /t { echo -n "U"; echo -n "-U"; }
produces only "U" as output, while I expect it to produce "U-U".

At the same time this configuration:
location /t { echo -n "-"; }
produces expected "-".

Looking at the debugger output, seems that anything started with "-" treated as option, even in commas and even if it is not a valid option.

Is it bug or feature?
Is there a way to overcome such behavior without introducing variable?

should we make build.sh more common ?

module echo-nginx-module usually added to stock nginx.
however, build.sh compiles nginx without many common modules, i.e. --without-http_autoindex_module, --without-http_auth_basic_module, ....

I suggest to remove those "without"s in order to make test closer to what people usually do with nginx.

Windows MSVC 2010 Compatibility

Hello there,

Thanks for your module.
Do you plan to work on msvc compatibility ?
I can't compile nginx with echo module for now.

Thanks.

feature request: PUT with file as body

hi agentzh

we use the upload module http://www.grid.net.ru/nginx/upload.en.html to upload big files. what we want to achieve is to issue a PUT sub-request with the uploaded file to store the file somewhere else based on its hash (hash generation is done by the upload module)

what would be nice to have is something like a file option to replace the "-b" option like this::

echo_subrequest PUT /some_upstream/$upload_file_md5 -f $upload_tmp_path

what do you think about such an implementation? we are also interested in contributing, but want to make shure that this is the right way to do it.

Can not be compiled with DDEBUG=2 defined.

Fresh master branch.
Playing with other module (replace-filter-nginx-module), and enabled DDEBUG=2 for extra debug output found that echo-nginx-module can not be compiled with these settings.

configure command line:
./configure --with-cc-opt='-DNGX_LUA_USE_ASSERT -DNGX_LUA_ABORT_AT_PANIC -g -ggdb3 -O0 -DDEBUG -DDDEBUG=2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' --with-debug --with-pcre --with-pcre-jit --with-ipv6 --with-poll_module --add-module=.. --add-module=../lua-nginx-module --add-module=../echo-nginx-module

Error message for make:

In file included from ../echo-nginx-module/src/ngx_http_echo_module.c:10:0: ../echo-nginx-module/src/ddebug.h:33:1: error: ‘inline’ is not at beginning of declaration [-Werror=old-style-declaration] static void ngx_inline ^

# uname -a Linux ng18 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86_64 GNU/Linux
gcc version 4.9.2 (Debian 4.9.2-10)

POST subrequest body doesn't get passed to fastcgi

Hi,

Here is my config

location /hello {
default_type text/plain;
echo_subrequest POST '/test' -q 'foo=Foo&bar=baz' -b 'request_body=test&test=3';
}

location /test {
# default example works
#echo "querystring: $query_string";
#echo "method: $echo_request_method";
#echo "body: $echo_request_body";
#echo "content length: $http_content_length";
#echo '///';

fastcgi_pass   127.0.0.1:1234;
include        fastcgi_params;
fastcgi_param  SCRIPT_FILENAME  /root/test.php;

#deny all;

}

In test.php file I have this:

On echo $HTTP_RAW_POST_DATA; ?>

When I make a request with the default example I can see

curl 'http://localhost/hello'
querystring: foo=Foo&bar=baz
method: POST
body: request_body=test&test=3
content length: 24
///

When I make the same request with fastcgi I can see

curl 'http://localhost/hello'
Array
(
[foo] => Foo
[bar] => baz
)
Array
(
)

So, as you can see GET params are passed. No request_body or POST params though.

I expect it to output:
Array
(
[foo] => Foo
[bar] => baz
)
Array
(
[request_body] => test
[test] => 3
)
request_body=test&test=3

Is this a bug or it is by design?

I'm using v0.37 which comes with nginx 1.1.13.

echo_location 不能获取内容,出现404

主要配置如下:

http {
    include     mime.types;
    default_type text/html;
    server {
        listen  80;
        root    /home/wwwroot;
        index   index.html;
        location / {
            echo_location /sub1;
            echo_location /sub2;
        }
        location /sub1 {
            proxy_pass http://127.0.0.1:8080;
        }
        location /sub2 {
            proxy_pass http://127.0.0.1:8080;
        }
    }
    server {
        listen  8080;
        root    /home/wwwroot;
        index   index.html;
    }
}

curl http://127.0.0.1:8080 是ok的,但 curl http://127.0.0.1:80 是404.

`NGX_ERROR` is dealt with twice in `ngx_http_echo_send_chain_link`

     99 ngx_int_t
    100 ngx_http_echo_send_chain_link(ngx_http_request_t* r,
    101     ngx_http_echo_ctx_t *ctx, ngx_chain_t *in)
    102 {
    103     ngx_int_t        rc;
    104       
    105     rc = ngx_http_echo_send_header_if_needed(r, ctx);
    106 
    107     if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
    108         return rc;
    109     } 
    110     
    111     if (rc == NGX_ERROR) {
    112         return NGX_HTTP_INTERNAL_SERVER_ERROR;
    113     } 

nginx-1.5.4 test location-async.t test 16 not ok

I edited test location-async.t TEST 16 to its own file.

Test output:

% TEST_NGINX_NO_CLEAN=1 TEST_NGINX_BINARY=./objs/nginx prove -r ../location-async-16.t
../location-async-16.t .. 1/2 
#   Failed test 'TEST 16: unsafe uri - status code ok'
#   at /usr/local/share/perl5/Test/Nginx/Socket.pm line 788.
#          got: ''
#     expected: '200'

#   Failed test 'TEST 16: unsafe uri - response_body_like - response is expected ()'
#   at /usr/local/share/perl5/Test/Nginx/Socket.pm line 1122.
#                   ''
#     doesn't match '(?^s:500 Internal Server Error)'
WARNING: TEST 16: unsafe uri - 2013/08/30 19:31:13 [alert] 17414#0: *1 header already sent, client: 127.0.0.1, server: localhost, request: \"GET /unsafe HTTP/1.1\", host: \"localhost\" at /usr/local/share/perl5/Test/Nginx/Socket.pm line 1002.
# Looks like you failed 2 tests of 2.
../location-async-16.t .. Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/2 subtests 

Test Summary Report
-------------------
../location-async-16.t (Wstat: 512 Tests: 2 Failed: 2)
  Failed tests:  1-2
  Non-zero exit status: 2
Files=1, Tests=2,  0 wallclock secs ( 0.02 usr  0.01 sys +  0.13 cusr  0.03 csys =  0.19 CPU)
Result: FAIL
% ./objs/nginx -V                                                                     
nginx version: nginx/1.5.4
built by gcc 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC) 
configure arguments: --with-http_addition_module --add-module=agentzh-echo-nginx-module-4de92b1 --add-module=chaoslawful-lua-nginx-module-e549fc2 --with-debug

I'm not quite sure how to fix this. nginx just ends connection.

% telnet localhost 1984
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /unsafe HTTP/1.1
Host: localhost

Connection closed by foreign host.
[1]    17085 exit 1     telnet localhost 1984

I bisected and the test changed at:

commit 0fea0bf3f7982348fd6ec9d14ebd946c783445b0
Author: Sergey Kandaurov <[email protected]>
Date:   Tue Jul 30 15:04:46 2013 +0400

    Added safety belt for the case of sending header twice.

    The aforementioned situation is abnormal per se and as such it now forces
    request termination with appropriate error message.

`echo` after `echo_read_request_body` seems not to behavior as expected

conf snippet as follows:

    location /echo {
        echo "header";
        echo_read_request_body;
        echo_request_body;
        echo "trailer";
    }

Issue a request using curl like:

     curl -i http://127.0.0.1/echo -d "body"

got reply as:

    HTTP/1.1 200 OK
    Server: nginx/1.4.3
    Date: Fri, 03 Jan 2014 16:55:47 GMT
    Content-Type: text/plain
    Transfer-Encoding: chunked
    Connection: keep-alive

    header
    body

And I'm missing the "trailer".

I tried to debug it using gdb, found that the last echo was executed as expected. But not getting the output it generated.

`-n` option will bypass all the strings following an empty varaiable

conf snippet as follows:

    location /echo {
        set $empty "";
        echo -n $empty hello world;
    }

a test case which expected an empty response body passed,
i reviewed the code, and found the related code snippet:

    if (opts && opts->nelts > 0) {
        opt = opts->elts;
        if (opt[0].len == 1 && opt[0].data[0] == 'n') {
            goto done;
        }
    }

    if (cl && cl->buf == NULL) {
        cl = cl->next;
    }

is switching these two block codes a possible solution for the reported problem?

Chunking of subrequests

Hey

For echo_flush it states:

This directive will fail to flush the output buffer in case of subrequests get involved

Does chunking subrequests work however with this module (on nginx 1.5+; chunking is part of nginx core since 1.3.9)? (no need for echo_flush then)

echo_read_request_body in content phase

In some cases, $request_body very useful, for example - send json body into database query in ngx_postgres module. Echo could fill in $request_body variable, but content phase it's too late for initialize it.
Can you move this directive into rewrite phase like in "form input module"?

$echo_client_request_headers goes past headers

With this test from your chunking module, $echo_client_request_headers goes past headers and outputs body.

 vi:filetype=

use lib 'lib';
use Test::Nginx::LWP::Chunkin;

repeat_each(2);

plan tests => repeat_each() * (blocks() + 1);

run_tests();

__DATA__

=== TEST 6: raw request headers (indeed chunked)
--- config
    chunkin on;
    location /main {
        echo 'headers:';
        echo -n $echo_client_request_headers;
    }
--- request
POST /main
--- chunked_body eval
["hello", "world"]
--- error_code: 200
--- response_body eval
"headers:
POST /main HTTP/1.1\r
Host: localhost:\$ServerPortForClient\r
User-Agent: Test::Nginx::LWP\r
Content-Type: text/plain\r
Transfer-Encoding: chunked\r
\r
"

You can try it:

POST /main HTTP/1.1
Host: foo
Transfer-Encoding: chunked

5
hello
0

Output is something like:

HTTP/1.1 200 OK
Server: nginx/1.2.7 (no pool)
Date: Thu, 14 Mar 2013 16:35:45 GMT
Content-Type: text/plain
Transfer-Encoding: chunked
Connection: close

9
headers:

4d
POST /main HTTP/1.1
Host: foo
Transfer-Encoding: chunked

5
hello
0


0

Something like this is needed:

 --- a/src/ngx_http_echo_request_info.c
+++ b/src/ngx_http_echo_request_info.c
@@ -267,21 +267,6 @@ ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r,
             }
 #endif

-            for (; p != last; p++) {
-                if (*p == '\0') {
-                    if (p + 1 == last) {
-                        /* XXX this should not happen */
-                        dd("found string end!!");
-
-                    } else if (*(p + 1) == LF) {
-                        *p = CR;
-
-                    } else {
-                        *p = ':';
-                    }
-                }
-            }
-
             if (b == r->header_in) {
                 break;
             }
@@ -296,17 +281,29 @@ ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r,
         } else {
             last = ngx_copy(v->data, r->request_line.data, size);
         }
+    }

-        for (p = v->data; p != last; p++) {
-            if (*p == '\0') {
-                if (p + 1 != last && *(p + 1) == LF) {
-                    *p = CR;
-
-                } else {
-                    *p = ':';
-                }
-            }
-        }
+    for (p = v->data; p != last; p++) {
+   if (*p == '\0') {
+       if (p + 1 == last) {
+       /* XXX this should not happen */
+       dd("found string end!!");
+       
+       } else if (*(p + 1) == LF) {
+       *p = CR;
+       
+       } else {
+       *p = ':';
+       }
         }
+   if (p + 3 != last
+       && p[0] == CR && p[1] == LF 
+       && p[2] == CR && p[3] == LF)
+   {
+       last = p + 2;
+       break;
+   }
     }

     v->len = last - v->data;

Release new version (dynamic module support)

Hello @agentzh,

Is it possible to release a new version including the dynamic module support? I'd like to split the module into a separate nginx debian package.

This is the last module that I am opening an new release issue :)

error: too many arguments to function 'ngx_time_update'

I'm not able to compile this into NginX 1.0.11:

/var/opt/agentzh-echo-nginx-module-03a2fd2//src/ngx_http_echo_timer.c: In function 'ngx_http_echo_timer_elapsed_variable':
/var/opt/agentzh-echo-nginx-module-03a2fd2//src/ngx_http_echo_timer.c:32:5: error: too many arguments to function 'ngx_time_update'
src/core/ngx_times.h:23:6: note: declared here
/var/opt/agentzh-echo-nginx-module-03a2fd2//src/ngx_http_echo_timer.c: In function 'ngx_http_echo_exec_echo_reset_timer':
/var/opt/agentzh-echo-nginx-module-03a2fd2//src/ngx_http_echo_timer.c:70:5: error: too many arguments to function 'ngx_time_update'
src/core/ngx_times.h:23:6: note: declared here
make[1]: *** [objs/addon/src/ngx_http_echo_timer.o] Error 1
make[1]: Leaving directory `/var/opt/nginx-1.0.11'

How to use echo to delay a request before passing it via proxy_pass ?

I've tried this:

          location /proxy_pass {
          proxy_pass http://svr_backend;
          include proxy.inc;
          }

          location / {
          echo_sleep 5.0;
          echo_location /proxy_pass;
          }

The problem is that I always get a "file being downloaded" when any request is performed, instead of the website being show in the browser when echo module is not used... ?

What I want to achieve, is unless the client wait 5 seconds, the request won't be processed by the upstream server.

Unable to use variables as arguments to `echo_subrequest`

With this config:

    location ~ ^/delay/(?<delay>[0-9.]+)/(?<originalURL>.*)$ {
        # echo_blocking_sleep $delay;
        echo_subrequest '$echo_request_method ' '/$originalURL' -q '$args';
    }

When I try to execute:

curl -v 'http://localhost/delay/0.343/api/?a=b'

I get this in my errors.log:

unknown option for echo_subrequest_async: a=b

However, if I replace the first argument to echo_subrequest directive with a static string:

        echo_subrequest 'GET' '/$originalURL' -q '$args';

The subrequest executes as intended.


It seems that ngx_http_echo_eval_cmd_args falters a bit if the first argument passed to it is a variable (i.e. value[i].lengths != NULL). In that case, it continues to expect opts (expects_opts remains 1) and it misinterprets the -q as an opt instead of an arg in the third iteration.

subsequent echo memc locations results in waiting client

hi
to reproduce, create the following locations:

location = "/set" {
    set $memc_cmd 'set';
    set $memc_key 'jalla';
    set $memc_value 'myvalue';
    set $memc_exptime 24;
    memc_pass mc;
}


location = "/get" {
    set $memc_cmd 'get';
    set $memc_key 'jalla';
    memc_pass mc;
}

location = "/delete" {
    set $memc_cmd 'delete';
    set $memc_key 'jalla';
    memc_pass mc;
}
location = "/flush" {
    echo_location /get;
    echo "";
    echo_location /delete;
    break;
}

this example only works with the echo ""; line. seems that the client waits on more data when calling /flush. i am not sure if this is a memc issue or a echo module issue.

curl http://localhost:8283/set
curl http://localhost:8283/flush

regards, bernd

output file content

I'm testing things and want to know if this is possible ?

 location / {
                content_by_lua '
                local mysql = require "resty.mysql"
                local db, err = mysql:new()
                if not db then
                    ngx.say("failed to instantiate mysql: ", err)
                    return
                end

  here i handle a query and if oke then
    ngx.say(/js/jsfile1.js)
    ngx.say(/js/jsfile2.js)
    ngx.say(/vol/www/lala/js/jsfile3.js)
   ngx.say(/home/bla/js/jsfile3.js)
  end
 '
}

The goal is to output file content after a query check.
The content is in this case javascript for the client.

how to use echo in .htaccess file ?

i had already installed echo module for my nginx, and also i can use the echo command in the main nginx config file nginx.conf. but when i use the seem command in my .htaccess file it dosent't work anymore.

please help me, thanks!

Support for gzip in the filter directives

Hello. We have some upstream providers that respond with JSON, and we wrap this response in a callback function in Nginx. It works if the response is in plain text, but if the response was gzipped, we would get something like hello(Ŗ[??6ǿ??s.?ٲ?֗RJiZ??a1?,'?q,זw??%q.^e????G? ...); which the client can't understand. Here's how we have it set up:

location ^~ /example/ {
        echo_before_body 'hello(';
        rewrite ^/example/ /test.json
        proxy_pass http://example.com:80/;
        echo_after_body ');';
}

Our current fix is to strip the Accept-Encoding field and pass that to the upstream provider. I was wondering if it's possible for the echo module to automatically gzip the responses in the future. Thanks!

Question of some directives's definition

Learning your excellent code now, and running into the following question:

    { ngx_string("echo_after_body"),
      NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_ANY,
      ngx_http_echo_echo_after_body,
      NGX_HTTP_LOC_CONF_OFFSET,
      offsetof(ngx_http_echo_loc_conf_t, after_body_cmds),
      NULL },

    { ngx_string("echo_location_async"),
      NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12,
      ngx_http_echo_echo_location_async,
      NGX_HTTP_LOC_CONF_OFFSET,
      0,  
      NULL },

I find echo_location[_async] and several other directives's definitions lack
offset somehow. A wild guess: ngx_http_echo_helper parses them correctly
just because handler_cmds is the first member of ngx_http_echo_loc_conf_t.

Is this done on purpose or what?

Thanks.

POST subrequest body doesn't get parent's request body

hi
here is my config and code(ngx_http_echo_subrequest.c->ngx_http_echo_parse_subrequest_spec)

location /fp_guess {

        echo_subrequest_async POST /sub1 -h 'body';
        #echo_subrequest_async POST /sub2;
        #echo_subrequest_async POST /sub3;
        #echo_subrequest_async POST /sub4;
    }
    location /sub1 {
        proxy_pass http://192.168.19.223:8980/fp_search.php;
    }

...............................................
...............................................
if (ngx_strncmp("-h", arg->data, arg->len) == 0) {
275 to_write = &h_str;
276 expecting_opt = 0;
277 continue;
278 }
279 }
280
281 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
282 "unknown option for echo_subrequest_async: %V", arg);
283
284 return NGX_ERROR;
285 }
286
287 if (h_str != NULL && h_str->len) {
288 parsed_sr->query_string = &r->args;
289 if (r->request_body == NULL) {
290 return NGX_ERROR;
291 }
292
293 rb = r->request_body; // ????? is wrong?
294
295 } else if (body_str != NULL && body_str->len) {
296 rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t));
297
298 if (rb == NULL) {
299 return NGX_ERROR;
300 }
301
302 parsed_sr->content_length_n = body_str->len;
303
304 b = ngx_calloc_buf(r->pool);
................................................................................................

rb = r->request_body
rb->bufs, rb->buf is 0x0 in this line , but r->request_body is in ngx_http_do_read_client_request_body(), did i miss something or the code is wrong?

./configure: error: no ~/src/echo-nginx-module-0.58/config was found

通过brew安装nginx之后,再编译安装echo-nginx-module时,总是提示没有config文件,可echo-nginx-module-0.58目录确实有config文件,什么原因?
➜ nginx-1.8.0 nginx -?
nginx version: nginx/1.8.0
Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]

Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-q : suppress non-error messages during configuration testing
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /usr/local/Cellar/nginx/1.8.0/)
-c filename : set configuration file (default: /usr/local/etc/nginx/nginx.conf)
-g directives : set global directives out of configuration file
➜ nginx-1.8.0 ./configure --prefix=/usr/local/Cellar/nginx/1.8.0 --add-module=~/src/echo-nginx-module-0.58
checking for OS

  • Darwin 15.0.0 x86_64
    checking for C compiler ... found
  • using Clang C compiler
  • clang version: 7.0.0 (clang-700.1.76)
    checking for gcc builtin atomic operations ... found
    checking for C99 variadic macros ... found
    checking for gcc variadic macros ... found
    checking for unistd.h ... found
    checking for inttypes.h ... found
    checking for limits.h ... found
    checking for sys/filio.h ... found
    checking for sys/param.h ... found
    checking for sys/mount.h ... found
    checking for sys/statvfs.h ... found
    checking for crypt.h ... not found
    checking for Darwin specific features
  • kqueue found
    checking for kqueue's EVFILT_TIMER ... found
    checking for Darwin 64-bit kqueue millisecond timeout bug ... not found
    checking for sendfile() ... found
    checking for atomic(3) ... found
    checking for nobody group ... found
    checking for poll() ... found
    checking for /dev/poll ... not found
    checking for crypt() ... found
    checking for F_READAHEAD ... not found
    checking for posix_fadvise() ... not found
    checking for O_DIRECT ... not found
    checking for F_NOCACHE ... found
    checking for directio() ... not found
    checking for statfs() ... found
    checking for statvfs() ... found
    checking for dlopen() ... found
    checking for sched_yield() ... found
    checking for SO_SETFIB ... not found
    checking for SO_ACCEPTFILTER ... not found
    checking for TCP_DEFER_ACCEPT ... not found
    checking for TCP_KEEPIDLE ... not found
    checking for TCP_FASTOPEN ... found
    checking for TCP_INFO ... not found
    checking for accept4() ... not found
    checking for eventfd() ... not found
    checking for eventfd() (SYS_eventfd) ... not found
    checking for int size ... 4 bytes
    checking for long size ... 8 bytes
    checking for long long size ... 8 bytes
    checking for void * size ... 8 bytes
    checking for uint64_t ... found
    checking for sig_atomic_t ... found
    checking for sig_atomic_t size ... 4 bytes
    checking for socklen_t ... found
    checking for in_addr_t ... found
    checking for in_port_t ... found
    checking for rlim_t ... found
    checking for uintptr_t ... uintptr_t found
    checking for system byte ordering ... little endian
    checking for size_t size ... 8 bytes
    checking for off_t size ... 8 bytes
    checking for time_t size ... 8 bytes
    checking for setproctitle() ... not found
    checking for pread() ... found
    checking for pwrite() ... found
    checking for sys_nerr ... found
    checking for localtime_r() ... found
    checking for posix_memalign() ... found
    checking for memalign() ... not found
    checking for mmap(MAP_ANON|MAP_SHARED) ... found
    checking for mmap("/dev/zero", MAP_SHARED) ... found but is not working
    checking for System V shared memory ... found
    checking for POSIX semaphores ... found but is not working
    checking for POSIX semaphores in libpthread ... found but is not working
    checking for POSIX semaphores in librt ... not found
    checking for struct msghdr.msg_control ... found
    checking for ioctl(FIONBIO) ... found
    checking for struct tm.tm_gmtoff ... found
    checking for struct dirent.d_namlen ... found
    checking for struct dirent.d_type ... found
    checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
    checking for openat(), fstatat() ... found
    checking for getaddrinfo() ... found
    configuring additional modules
    adding module in ~/src/echo-nginx-module-0.58
    ./configure: error: no ~/src/echo-nginx-module-0.58/config was found

echo_exec can not after echo, may cause worker process exited on signal 11

Nginx Conf

events {
 use epoll;
 multi_accept off;
 reuse_port on;
 worker_connections  1048576;
 debug_connection 127.0.0.1;
 debug_connection localhost;
}

error_log /var/log/nginx/error.log debug;

server {                                                                                                                                                                            
   listen       80 backlog=65535;
   server_name  lua.biliops.com;

   location / {
    set $name "higkoo";
    echo "name: $name"; # Error on add, normal on del.
    echo_exec /version;
   }

   location /version {
    content_by_lua '
        if jit then
            ngx.say(jit.version)
        else
            ngx.say(_VERSION)
        end
    ';
   }
}

Error Info

# curl -i lua.biliops.com
curl: (52) Empty reply from server

Configure

# nginx -V
Tengine version: Tengine/2.1.1 (nginx/1.6.2)
built by gcc 4.9.2 (Debian 4.9.2-10) 
TLS SNI support enabled
configure arguments: --with-debug --user=www-data --group=www-data --with-pcre-jit \
--prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --dso-tool-path=/usr/sbin/dso_tool \
--dso-path=/usr/share/nginx/modules --conf-path=/etc/nginx/nginx.conf \
--http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log \
--lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid \
--http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-syslog --with-jemalloc --with-mail \
--with-http_lua_module --with-mail_ssl_module --with-http_ssl_module \
--with-http_auth_request_module --with-http_dav_module --with-http_gzip_static_module \
--with-http_image_filter_module --with-http_spdy_module --with-http_stub_status_module \
--with-http_realip_module --with-luajit-inc=/usr/include/luajit-2.0 \
--with-luajit-lib=/usr/lib/x86_64-linux-gnu --with-ld-opt=-Wl,-z,relro \
--with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' \
--add-module=../echo-nginx-module-0.58 --add-module=../ngx_cache_path_status-1.0 \
--add-module=../redis2-nginx-module-0.12 --add-module=../headers-more-nginx-module-0.261 \
--add-module=../ngx-fancyindex-0.3.5 --add-module=../memc-nginx-module-0.16 \
--add-module=../nginx-rtmp-module-1.1.7 --add-module=../ngx_slowfs_cache_p2p-1.10 \
--add-module=../ngx_devel_kit-0.2.19

System log

nginx[2233]: segfault at 0 ip 000000000041fc54 sp 00007ffc9bd76ac0 error 4 in nginx[400000+198000]

Debug log

[debug] 2233#0: accept on 0.0.0.0:80, ready: 0
[debug] 2233#0: posix_memalign: 00007FED1284C300:256 @16
[debug] 2233#0: *3 accept: 192.168.9.199 fd:4
[debug] 2233#0: event dummy accept filter
[debug] 2233#0: posix_memalign: 00007FED1284C400:256 @16
[debug] 2233#0: *3 event timer add: 4: 60000:1451411133579
[debug] 2233#0: *3 reusable connection: 1
[debug] 2233#0: *3 epoll add event: fd:4 op:1 ev:80002001
[debug] 2233#0: *3 http wait request handler
[debug] 2233#0: *3 malloc: 00007FED12839C00:1024
[debug] 2233#0: *3 recv: fd:4 79 of 1024
[debug] 2233#0: *3 reusable connection: 0
[debug] 2233#0: *3 posix_memalign: 00007FED128DC000:4096 @16
[debug] 2233#0: *3 http process request line
[debug] 2233#0: *3 http request line: "GET / HTTP/1.1"
[debug] 2233#0: *3 http uri: "/"
[debug] 2233#0: *3 http args: ""
[debug] 2233#0: *3 http exten: ""
[debug] 2233#0: *3 http process request header line
[debug] 2233#0: *3 http header: "User-Agent: curl/7.38.0"
[debug] 2233#0: *3 http header: "Host: lua.biliops.com"
[debug] 2233#0: *3 posix_memalign: 00007FED1292D000:4096 @16
[debug] 2233#0: *3 http header: "Accept: */*"
[debug] 2233#0: *3 http header done
[debug] 2233#0: *3 event timer del: 4: 1451411133579
[debug] 2233#0: *3 generic phase: 0
[debug] 2233#0: *3 rewrite phase: 1
[debug] 2233#0: *3 test location: "/"
[debug] 2233#0: *3 using configuration "/"
[debug] 2233#0: *3 http cl:-1 max:67108864
[debug] 2233#0: *3 rewrite phase: 3
[debug] 2233#0: *3 http script value: "higkoo"
[debug] 2233#0: *3 http script set $name
[debug] 2233#0: *3 post rewrite phase: 4
[debug] 2233#0: *3 generic phase: 5
[debug] 2233#0: *3 generic phase: 6
[debug] 2233#0: *3 generic phase: 7
[debug] 2233#0: *3 generic phase: 8
[debug] 2233#0: *3 access phase: 9
[debug] 2233#0: *3 access phase: 10
[debug] 2233#0: *3 access phase: 11
[debug] 2233#0: *3 post access phase: 12
[debug] 2233#0: *3 http script copy: "name: "
[debug] 2233#0: *3 http script var: "higkoo"
[debug] 2233#0: *3 lua capture header filter, uri "/"
[debug] 2233#0: *3 HTTP/1.1 200 OK
Server: Tengine
Date: Tue, 29 Dec 2015 23:33:33 GMT
Content-Type: text/plain
Transfer-Encoding: chunked
Connection: keep-alive
[debug] 2233#0: *3 write new buf t:1 f:0 00007FED1292D378, pos 00007FED1292D378, size: 151 file: 0, size: 0
[debug] 2233#0: *3 http write filter: l:0 f:0 s:151
[debug] 2233#0: *3 http output filter "/?"
[debug] 2233#0: *3 http copy filter: "/?"
[debug] 2233#0: *3 lua capture body filter, uri "/"
[debug] 2233#0: *3 http trim filter
[debug] 2233#0: *3 http footer body filter
[debug] 2233#0: *3 image filter
[debug] 2233#0: *3 http postpone filter "/?" 00007FED1292D488
[debug] 2233#0: *3 http chunk: 12
[debug] 2233#0: *3 http chunk: 1
[debug] 2233#0: *3 write old buf t:1 f:0 00007FED1292D378, pos 00007FED1292D378, size: 151 file: 0, size: 0
[debug] 2233#0: *3 write new buf t:1 f:0 00007FED1292D528, pos 00007FED1292D528, size: 3 file: 0, size: 0
[debug] 2233#0: *3 write new buf t:0 f:0 00007FED1292D248, pos 00007FED1292D248, size: 12 file: 0, size: 0
[debug] 2233#0: *3 write new buf t:0 f:0 00000000007B06A8, pos 00000000007B06A8, size: 1 file: 0, size: 0
[debug] 2233#0: *3 write new buf t:0 f:0 0000000000000000, pos 000000000054A17D, size: 2 file: 0, size: 0
[debug] 2233#0: *3 http write filter: l:0 f:0 s:169
[debug] 2233#0: *3 http copy filter: 0 "/?"
[debug] 2233#0: *3 internal redirect: "/version?"
[debug] 2233#0: *3 rewrite phase: 1
[debug] 2233#0: *3 test location: "/"
[debug] 2233#0: *3 test location: "version"
[debug] 2233#0: *3 using configuration "/version"
[debug] 2233#0: *3 http cl:-1 max:67108864
[debug] 2233#0: *3 rewrite phase: 3
[debug] 2233#0: *3 post rewrite phase: 4
[debug] 2233#0: *3 generic phase: 5
[debug] 2233#0: *3 generic phase: 6
[debug] 2233#0: *3 generic phase: 7
[debug] 2233#0: *3 generic phase: 8
[debug] 2233#0: *3 access phase: 9
[debug] 2233#0: *3 access phase: 10
[debug] 2233#0: *3 access phase: 11
[debug] 2233#0: *3 post access phase: 12
[debug] 2233#0: *3 lua content handler, uri:"/version" c:2
[debug] 2233#0: *3 lua reset ctx
[debug] 2233#0: *3 lua creating new thread
[debug] 2233#0: *3 http cleanup add: 00007FED1292D7E0
[debug] 2233#0: *3 lua run thread, top:0 c:2
[debug] 2233#0: *3 lua allocate new chainlink and new buf of size 13, cl:00007FED1292D7F8
[debug] 2233#0: *3 lua say response
[debug] 2233#0: *3 http output filter "/version?"
[debug] 2233#0: *3 http copy filter: "/version?"
[debug] 2233#0: *3 lua capture body filter, uri "/version"
[debug] 2233#0: *3 http trim filter
[debug] 2233#0: *3 http footer body filter
[debug] 2233#0: *3 image filter
[debug] 2233#0: *3 http postpone filter "/version?" 00007FED1292D7F8
[debug] 2233#0: *3 http chunk: 13
[alert] 2333#0: worker process 2233 exited on signal 11
[debug] 3333#0: epoll add event: fd:4 op:1 ev:00002001

Add null option to ignore content output of sub-requests

If it's feasible, an option for echo_location and echo_location_async to ignore the output of the subrequests would be helpful for running some subrequests that handle various cleanup. memcache "get" followed by memc "delete" for example.

是不是不支持 nginx/1.9.14 版本?

下载了:echo-nginx-module-0.59rc1.tar 文件
安装模块步骤:
./configure --prefix=/usr/local/appsoft/nginx/app --with-http_ssl_module --with-http_image_filter_module --add-module=/usr/local/appsoft/nginx/modules/echo-nginx-module
make、make install,
并复制了objs下的nginx到/usr/local/appsoft/nginx/app/sbin目录

使用nginx -V,提示如下:
configure arguments: --prefix=/usr/local/appsoft/nginx/app --with-http_ssl_module --with-http_image_filter_module --add-module=/usr/local/appsoft/nginx/modules/echo-nginx-module

说明已经安装成功,在nginx.conf中使用echo
location / {
echo "---------------------start-----------------";
root html;
index index.html index.htm;
echo "--------------------------HELLO-----------------------------------";
}

访问ningx,nginx的页面正常打开,但是在nginx的日志文件及浏览器的响应信息中,具没有看到echo输出的内容,请问下是不是安装不正确还是?

Archlinux integration !

Hello,
Just for information I maintain the package of echo-nginx-module in AUR !
You can find it here or for arch user yaourt -S nginx-mod-echo-git

Hava nice day !

Using `$echo_timer_elapsed` under locations without any echo directives causes coredump

sample config:

    location /echo {
        if ($echo_timer_elapsed) {}
    }

core file:

    Core was generated by `sbin/nginx'.
    Program terminated with signal 11, Segmentation fault.
    #0  0x00000000004fc1d2 in ngx_http_echo_timer_elapsed_variable (r=0x2739770, v=0x273a1b0, data=0)
        at ../echo-nginx-module-0.49/src/ngx_http_echo_timer.c:25
    25      if (ctx->timer_begin.sec == 0) {
    (gdb) p ctx
    $1 = (ngx_http_echo_ctx_t *) 0x0

Clarify license & copyright holders

Hello!

Is it possible to clarify the module's licence and copyright? The License file does't match those stated in the README.

We are packaging nginx-echo in debian and we have to deal with that legal stuff :)

Thank you,
chris

echo_sleep with proxy_pass - no result if echo sleep before; no delay if echo_sleep after proxy_pass

Please check example below... it returns different results or timing in any of tests below:
-example 1 - testfast uses no echo-nginx-module specific commands...
-example 2 - testslow uses echo_sleep after proxy_pass.... no result text is sent to client, timing is ok
-example 3 - testslow2 uses echo_sleep before proxy_pass.... result text is ok, however timing is wrong.

You will find "Hello Worls in CURL response in example 1 and 3, but not in 2. In example 3 result returns without echo_sleep.

nginx .conf file:
location /testfast {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_pass http://ad-emea.demodomain.net/testdirect.ashx;
}

location /testslow {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_pass http://ad-emea.demodomain.net/testdirect.ashx;
echo_sleep 5.000;
}

location /testslow2 {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
echo_sleep 5.000;
proxy_pass http://ad-emea.demodomain.net/testdirect.ashx;
}

testing using curl: (all 3 above examples)... upstream server is always the same... returns 200 "Hello World"

curl --verbose http://ad-emea.demodomain.net/testfast

  • About to connect() to ad-emea.demodomain.net port 80 (#0)
  • Trying 192.168.1.147... connected
  • Connected to ad-emea.demodomain.net (192.168.1.147) port 80 (#0)

    GET /testfast HTTP/1.1
    User-Agent: Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 6.0; SV1; .NET CLR 1
    .1.4325)
    Host: ad-emea.demodomain.net
    Accept: text/javascript, text/html, application/xml, text/xml, /
    Accept-Language: en

    < HTTP/1.1 200 OK
    < Server: nginx/0.8.54
    < Date: Thu, 17 Feb 2011 12:48:16 GMT
    < Content-Type: text/plain; charset=utf-8
    < Connection: keep-alive
    < Cache-Control: private
    < P3P: policyref="/w3c/p3p.xml", CP="NOI DSP COR NID PSAo OUR IND"
    < Content-Length: 11
    <
    Hello World* Connection #0 to host ad-emea.demodomain.net left intact
  • Closing connection #0
    RESULT: works ok, result is returned. timing ok.

curl --verbose http://ad-emea.demodomain.net/testslow

  • About to connect() to ad-emea.demodomain.net port 80 (#0)
  • Trying 192.168.1.147... connected
  • Connected to ad-emea.demodomain.net (192.168.1.147) port 80 (#0)

    GET /testslow HTTP/1.1
    User-Agent: Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 6.0; SV1; .NET CLR 1
    .1.4325)
    Host: ad-emea.demodomain.net
    Accept: text/javascript, text/html, application/xml, text/xml, /
    Accept-Language: en

    < HTTP/1.1 200 OK
    < Server: nginx/0.8.54
    < Date: Thu, 17 Feb 2011 12:48:22 GMT
    < Content-Type: text/plain
    < Transfer-Encoding: chunked
    < Connection: keep-alive
    <
  • Connection #0 to host ad-emea.demodomain.net left intact
  • Closing connection #0
    RESULT: ERROR: no result text returned, timing ok

curl --verbose http://ad-emea.demodomain.net/testslow2

  • About to connect() to ad-emea.demodomain.net port 80 (#0)
  • Trying 192.168.1.147... connected
  • Connected to ad-emea.demodomain.net (192.168.1.147) port 80 (#0)

    GET /testslow2 HTTP/1.1
    User-Agent: Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 6.0; SV1; .NET CLR 1
    .1.4325)
    Host: ad-emea.demodomain.net
    Accept: text/javascript, text/html, application/xml, text/xml, /
    Accept-Language: en

    < HTTP/1.1 200 OK
    < Server: nginx/0.8.54
    < Date: Thu, 17 Feb 2011 12:48:26 GMT
    < Content-Type: text/plain; charset=utf-8
    < Connection: keep-alive
    < Cache-Control: private
    < P3P: policyref="/w3c/p3p.xml", CP="NOI DSP COR NID PSAo OUR IND"
    < Content-Length: 11
    <
    Hello World* Connection #0 to host ad-emea.demodomain.net left intact
  • Closing connection #0
    RESULT: ERROR: result text ok, timing ERROR (as if no echo_sleep command)

my enviorment:
nginx version: nginx/0.8.54
built by gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=www-data --group=www-data --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-cc-opt=-O2 --with-http_gzip_static_module --with-http_ssl_module --with-http_geoip_module --add-module=/home/uporabnik/agentzh-echo-nginx-module-1c4e116

nginx return "000" http code when use echo command

hi, agentzh:

my conf like this:

location / {
echo "hello";
set $var "true";
if ($var = "true") {
}
}
nginx will return strange http code "000", and return nothing

but when I use other content phase commands like empty_gif, proxy_pass , uwsgi_pass with an empty if block , it can work well

Thank you

nginx 1.0.9 echo.t test 21 proxy not okay

I don't understand this test. I expect it to produce

Content-Type: text/plain Content-Length: 12 Connection: close

hello
world

But it produces:

Content-Type: text/plain Content-Length: 6 Connection: close

hello
world

Also test expects to get only hello

Result is:

PATH="$HOME"/nginx/sbin:"$PATH" prove -r t/echo.t
t/echo.t .. 1/43 WARNING: TEST 21: proxy - unexpected extra bytes after last chunk in response: "world\x{0a}"
t/echo.t .. ok
All tests successful.
Files=1, Tests=43, 4 wallclock secs ( 0.03 usr 0.01 sys + 0.50 cusr 1.01 csys = 1.55 CPU)
Result: PASS

I don't think test result should be ok as Content-Lenght is clearly wrong.

According to:
http://wiki.nginx.org/HttpEchoModule#echo

result from /echo should be

hello
world

I checked this test with 1.0.9 and

./configure
--user=nginx
--group=nginx
--prefix="$HOME"/nginx
--with-http_ssl_module
--with-http_realip_module
--with-http_addition_module
--with-http_xslt_module
--with-http_image_filter_module
--with-http_geoip_module
--with-http_sub_module
--with-http_dav_module
--with-http_flv_module
--with-http_gzip_static_module
--with-http_random_index_module
--with-http_secure_link_module
--with-http_degradation_module
--with-http_stub_status_module
--with-ipv6
--with-file-aio
--with-mail
--with-mail_ssl_module
--with-debug
and extra modules ngx_devel_kit ngx_http_echo

System to tests is Fedora 15 x86_64

I don't know if it is okay with v1.0.8 or smaller.

=== TEST 21: proxy
--- config
location /main {
proxy_pass http://127.0.0.1:$server_port/echo;
}
location /echo {
echo hello;
echo world;
}
--- request
GET /main
--- response_headers
Content-Length: 6
--- response_body
hello

SIGSEGV at src/ngx_http_echo_request_info.c:200

I compiled the most recent echo-nginx-module (v0.14-356-g02c40f1) with Nginx 1.10.1 using

nginx version: nginx/1.10.1
built by gcc 6.1.1 20160603 (GCC)
built with OpenSSL 1.0.2h  3 May 2016
TLS SNI support enabled
configure arguments: --pid-path=/var/run/nginx.pid --conf-path=/etc/nginx/core.conf --error-log-path=/var/log/nginx/nginx.log --user=www-data --group=www-data --with-ipv6 --without-poll_module --without-select_module --with-file-aio --with-http_ssl_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_degradation_module --with-http_stub_status_module --http-log-path=/var/log/nginx --with-pcre --with-pcre-jit --with-cc-opt='-O0 -g -pipe' --with-ld-opt=-Wl,-z,relro,-O1 --without-http_ssi_module --without-http_uwsgi_module --without-http_scgi_module --without-http_upstream_ip_hash_module --without-http_split_clients_module --without-http_empty_gif_module --with-http_v2_module --add-module=../ngx_http_substitutions_filter_module --add-module=/git/echo-nginx-module --with-debug

and now Nginx crashes with the backtrace I uploaded at http://mail.aegee.org/echo-nginx-crash/gdb.txt. In the configuration file I have

http {
  log_format postdata '$remote_addr - $remote_user [$time_local] '
  '"$request" $status $body_bytes_sent'
  '"$echo_client_request_headers"'
  '"$http_referer" "$http_user_agent" $request_body';
}

with echo_read_request_body; in the corresponding locations.

I would like to add that, when loading (with Chromium) several times https://www.anciens.org/wp-admin/load-styles.php?c=1&dir=ltr&load%5B%5D=dashicons,buttons,forms,l10n,login&ver=4.5.2 it is always delivered, but when I go to https://www.anciens.org/wp-login.php (which leads to convincing the browser to download the load-style.php), load-style.php is sometimes delivered and some times nginx crashes.

Any idea what went wrong?

Let me know if you need more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.