Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#124 closed enhancement (invalid)

ngx_http_subrequest() supports only GET method?

Reported by: Alexey Radkov Owned by: somebody
Priority: minor Milestone:
Component: nginx-core Version: 1.0.x
Keywords: Cc:
uname -a: Linux localhost.localdomain 2.6.35.14-106.fc14.x86_64 #1 SMP Wed Nov 23 13:07:52 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx: nginx version: nginx/1.0.10
nginx: configure arguments: --add-module=../contrib/nginx_http_echo_module/ --add-module=../nginx_http_rc_module --with-debug

Description

The question is why? Is this important for nginx healthy work?
I create subrequests in my own module for passing requests to a next upstream in a given list of upstreams until working server in some upstream in the list found (this is kind of failover technique). Original request's methods can be GET or POST. But ngx_http_subrequest() insists on GET only:

sr->method = NGX_HTTP_GET;
...
sr->method_name = ngx_http_core_get_method;

I changed these lines in ngx_http_subrequest() by:

sr->method = r->method;
...
sr->method_name = r->method_name;

May i have any problems with that? My tests shows nothing wrong.

Thank you!

Change History (2)

comment:1 by Maxim Dounin, 9 years ago

Resolution: invalid
Status: newclosed

Other modules rely on the method being set to GET, and this change will broke them. If you really need method to be preserved, you may restore it after ngx_http_subrequest() call. Note well that request body may require additional care if used in subrequests.

And, BTW, this is wrong place to ask questions, you may have better luck asking in mailing list(s).

comment:2 by Alexey Radkov, 9 years ago

Thank you, Maxim.

You are right. Next time i will ask at forum.

Note: See TracTickets for help on using tickets.