Strange behavior (BUG?) for setting r->headers_in.method_name in a subrequest

Mirko Dziadzka mirko.dziadzka at gmail.com
Mon Aug 30 20:31:13 MSD 2010


Hi all

I'm using nginx-0.7.66 and am trying to create a POST sub-request:

res = ngx_http_subrequest(r, uri, NULL , &sr, psr, flags);
sr->method = NGX_HTTP_POST;
sr->method_name.data = (u_char *)"POST";
sr->method_name.len = 4;

The uri is then forwarded via proxy_pass to another server.

With wireshark, I see the following bytes on the network:

00000000  50 4f 53 54 00 2f 64 65  63 69 64 65 2e 63 67 69 POST./de

Please note the 00-byte after the POST. If I change the code to

res = ngx_http_subrequest(r, uri, NULL , &sr, psr, flags);
sr->method = NGX_HTTP_POST;
sr->method_name.data = (u_char *)"POST "; // note the SPACE after POST
sr->method_name.len = 4;

it will work as expected and I see a space. I did not dig further into
nginx code but it looks like the 5-th byte from "POST" is used in the
new request - which is probably a bug.

Greetings

    Mirko








More information about the nginx-devel mailing list