plans for chunked encoding

Luka Perkov nginx at lukaperkov.net
Thu Nov 22 20:47:42 UTC 2012


Hi Maxim,

On Thu, Nov 22, 2012 at 08:24:29PM +0400, Maxim Dounin wrote:
...

> > $ curl -v -X POST -d "@/dev/null" --header "Transfer-Encoding: chunked" http://127.0.0.1:80/
> > 
> > Returns 404 in headers but 500 in html body. Is this how it's supposed to be ?

...

> If you indeed see 500 in body it might be something to do with 
> either your module or nginx config you use.

Here is full information from my side... First the nginx logs:

2012/11/22 21:46:00 [debug] 1237#0: *1 http cl:-1 max:1048576
2012/11/22 21:46:00 [debug] 1237#0: *1 rewrite phase: 2
2012/11/22 21:46:00 [debug] 1237#0: *1 post rewrite phase: 3
2012/11/22 21:46:00 [debug] 1237#0: *1 generic phase: 4
2012/11/22 21:46:00 [debug] 1237#0: *1 generic phase: 5
2012/11/22 21:46:00 [debug] 1237#0: *1 access phase: 6
2012/11/22 21:46:00 [debug] 1237#0: *1 post access phase: 7
2012/11/22 21:46:00 [debug] 1237#0: *1 content phase: 8
2012/11/22 21:46:00 [debug] 1237#0: *1 open index "/etc/nginx/html/index.html"
2012/11/22 21:46:00 [debug] 1237#0: *1 stat() "/etc/nginx/html/index.html" failed (2: No such file or directory)
2012/11/22 21:46:00 [debug] 1237#0: *1 http index check dir: "/etc/nginx/html"
2012/11/22 21:46:00 [error] 1237#0: *1 "/etc/nginx/html/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: , request: "POST / HTTP/1.1", host: "127.0.0.1"
2012/11/22 21:46:00 [debug] 1237#0: *1 http finalize request: 404, "/?" a:1, c:1
2012/11/22 21:46:00 [debug] 1237#0: *1 http special response: 404, "/?"
2012/11/22 21:46:00 [debug] 1237#0: *1 http set discard body
2012/11/22 21:46:00 [debug] 1237#0: *1 http chunked byte: 0D s:0
2012/11/22 21:46:00 [error] 1237#0: *1 client sent invalid chunked body, client: 127.0.0.1, server: , request: "POST / HTTP/1.1", host: "127.0.0.1"
2012/11/22 21:46:00 [debug] 1237#0: *1 HTTP/1.1 404 Not Found^M
Server: nginx/1.3.9^M
Date: Thu, 22 Nov 2012 20:46:00 GMT^M
Content-Type: text/html^M
Content-Length: 192^M
Connection: keep-alive^M
Keep-Alive: timeout=130^M

2012/11/22 21:46:00 [debug] 1237#0: *1 write new buf t:1 f:0 0000000001731EB8, pos 0000000001731EB8, size: 179 file: 0, size: 0
2012/11/22 21:46:00 [debug] 1237#0: *1 http write filter: l:0 f:0 s:179
2012/11/22 21:46:00 [debug] 1237#0: *1 http output filter "/?"
2012/11/22 21:46:00 [debug] 1237#0: *1 http copy filter: "/?"
2012/11/22 21:46:00 [debug] 1237#0: *1 write old buf t:1 f:0 0000000001731EB8, pos 0000000001731EB8, size: 179 file: 0, size: 0
2012/11/22 21:46:00 [debug] 1237#0: *1 write new buf t:0 f:0 0000000000000000, pos 00000000006781E0, size: 140 file: 0, size: 0
2012/11/22 21:46:00 [debug] 1237#0: *1 write new buf t:0 f:0 0000000000000000, pos 00000000006770E0, size: 52 file: 0, size: 0
2012/11/22 21:46:00 [debug] 1237#0: *1 http write filter: l:1 f:0 s:371
2012/11/22 21:46:00 [debug] 1237#0: *1 http write filter limit 0
2012/11/22 21:46:00 [debug] 1237#0: *1 writev: 371
2012/11/22 21:46:00 [debug] 1237#0: *1 http write filter 0000000000000000
2012/11/22 21:46:00 [debug] 1237#0: *1 http copy filter: 0 "/?"
2012/11/22 21:46:00 [debug] 1237#0: *1 http finalize request: 0, "/?" a:1, c:1
2012/11/22 21:46:00 [debug] 1237#0: *1 set http keepalive handler
2012/11/22 21:46:00 [debug] 1237#0: *1 http close request
2012/11/22 21:46:00 [debug] 1237#0: *1 http log handler
2012/11/22 21:46:00 [debug] 1237#0: *1 free: 0000000001731490, unused: 834
2012/11/22 21:46:00 [debug] 1237#0: *1 event timer add: 3: 130000:1353617290838
2012/11/22 21:46:00 [debug] 1237#0: *1 pipelined request
2012/11/22 21:46:00 [debug] 1237#0: *1 post event 00000000017116A0
2012/11/22 21:46:00 [debug] 1237#0: *1 delete posted event 00000000017116A0

And the curl:

$ curl -v -X POST -d "@/dev/null" --header "Transfer-Encoding: chunked" http://127.0.0.1:80/
* About to connect() to 127.0.0.1 port 80 (#0)
*   Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> POST / HTTP/1.1
> User-Agent: curl/7.28.0
> Host: 127.0.0.1
> Accept: */*
> Transfer-Encoding: chunked
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 7 out of 0 bytes
< HTTP/1.1 404 Not Found
< Server: nginx/1.3.9
< Date: Thu, 22 Nov 2012 20:46:00 GMT
< Content-Type: text/html
< Content-Length: 192
< Connection: keep-alive
< Keep-Alive: timeout=130
< 
<html>
<head><title>500 Internal Server Error</title></head>
<body bgcolor="white">
<center><h1>500 Internal Server Error</h1></center>
<hr><center>nginx/1.3.9</center>
</body>
</html>
* Connection #0 to host 127.0.0.1 left intact
* Closing connection #0

I have configured nginx like this (there are no custom modules):

$ _cfgdir=/etc/nginx
$ _tmpdir=/var/lib/nginx
$ ./configure \
	--with-debug \
	--prefix=$_cfgdir \
	--conf-path=$_cfgdir/nginx.conf \
	--sbin-path=/usr/sbin/nginx \
	--pid-path=/var/run/nginx.pid \
	--lock-path=/var/lock/nginx.lock \
	--user=http --group=http \
	--http-log-path=/var/log/nginx/access.log \
	--error-log-path=/var/log/nginx/error.log \
	--http-client-body-temp-path=$_tmpdir/client-body \
	--http-proxy-temp-path=$_tmpdir/proxy \
	--with-file-aio \
	\
	--without-http_auth_basic_module \
	--without-http_autoindex_module \
	--without-http_browser_module \
	--without-http_charset_module \
	--without-http_empty_gif_module \
	--without-http_fastcgi_module \
	--without-http_geo_module \
	--without-http_map_module \
	--without-http_memcached_module \
	--without-http_scgi_module \
	--without-http_scgi_module \
	--without-http_ssi_module \
	--without-http_userid_module \
	--without-http_uwsgi_module

And the config file I'm using:

user http http;
worker_processes  1;
# daemon off;

events {
        worker_connections 128;
}

http {
        include mime.types;
        default_type application/octet-stream;

        keepalive_timeout 130s 130s;
        gzip off;

        log_format minimal_generic '$remote_addr [$time_local] "$request" "$status" "$http_user_agent"';
        log_format minimal_proxy '$http_x_forwarded_for [$time_local] "$status" "$http_user_agent"';
        log_format full_generic '$remote_addr [$time_local] "$request" "$status" "$http_user_agent" "$request_body"';

        server {
                listen 80;

                location / {
                        access_log /var/log/nginx/local_dummy.log minimal_generic;
                        error_log /var/log/nginx/local_dummy_error.log debug;
                }
        }
}

This is on the last svn version. Maybe you can tell if I have
configured or using something wrong ?

Luka



More information about the nginx-devel mailing list