Problem with post_action when used with return 202; and POST request

Pyry Hakulinen pyry at automattic.com
Wed Aug 10 11:18:41 UTC 2011


Hi,

We are trying to use post_action in a location block that only has
"return 202;". Everything works fine for GET requests and with small
POST requests, but if the client request body + headers are over 1kB,
nginx will not trigger the post_action handler.

Test configuration, and debug log attached. Following commands can be
used to trigger the error:

dd if=/dev/zero of=request_body count=2
wget -d --post-file=request_body localhost:8022

Is this a bug or just the way it should work? I tested it with nginx
1.0.5 and 1.1.0, both appear to be working the same way.

I worked around it by creating a small module that just calls
ngx_http_read_client_request_body() and returns 202 from the callback.
But I feel that it might not be the right solution for this. (module
also attached)

Also while debugging I found another possibly related bug, if you do a
POST request against location / { return 202; } block, it will
incorrectly result in 2 lines in access log:

127.0.0.1 - - [10/Aug/2011:14:07:40 +0300] "POST / HTTP/1.1" 202 0 "-"
"curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o
zlib/1.2.3.4 libidn/1.18"
127.0.0.1 - - [10/Aug/2011:14:07:40 +0300] "foobar=foo" 400 172 "-" "-"

Happy to provide more information if needed. Thanks,
Pyry
-------------- next part --------------
worker_processes  1;
events {
    worker_connections  1024;
    debug_connection 127.0.0.1;
}
http {
    include       mime.types;
    default_type  application/octet-stream;

    server {
        listen 8024;
	    return 202;
    }
 
    server {
        listen       8022;
        server_name  localhost;

        location / {
            return 202;
            post_action @post;
        }
        location @post {
	        proxy_pass http://127.0.0.1:8024;
        }
    }
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: broken.log
Type: text/x-log
Size: 8809 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20110810/95927e2f/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ngx_http_ghetto_module.c
Type: text/x-csrc
Size: 2359 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20110810/95927e2f/attachment-0003.bin>


More information about the nginx mailing list