SSI forwards request method

Igor Sysoev is at rambler-co.ru
Wed Jan 9 00:03:47 MSK 2008


On Tue, Jan 08, 2008 at 03:50:07PM -0500, Larrytheliquid wrote:

> I've noticed that when using server side includes, the original document's
> request method is used for the includes of the subsequent documents.
> I would think that includes should be GET requests, regardless of the
> original document's request method (you can't add POST or PUT variables in
> the include statements, after all.)
> Should that be changed to always use GET?
> 
> Regardless, is it possible to change the request method from the Nginx side?
> 
> Redefining $request_method as follows seems to be disallowed:
> 
> set $request_method GET;
> # Compile message:
> # 2008/01/08 15:05:48 [emerg] 32758#0: the duplicate "request_method"
> variable in /usr/local/nginx/conf/nginx.conf:159

nginx uses GET in subrequests, however, this functionality is not complete.
The atached patch should fix the bug.


-- 
Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
Index: src/http/ngx_http_core_module.c
===================================================================
--- src/http/ngx_http_core_module.c	(revision 1176)
+++ src/http/ngx_http_core_module.c	(working copy)
@@ -113,6 +113,9 @@
 };
 
 
+static ngx_str_t  ngx_http_core_get_method = { 3, "GET " };
+
+
 #if (NGX_HTTP_GZIP)
 
 static ngx_conf_enum_t  ngx_http_gzip_http_version[] = {
@@ -1760,7 +1763,7 @@
     sr->subrequest_in_memory = (flags & NGX_HTTP_SUBREQUEST_IN_MEMORY) != 0;
 
     sr->unparsed_uri = r->unparsed_uri;
-    sr->method_name = r->method_name;
+    sr->method_name = ngx_http_core_get_method;
     sr->http_protocol = r->http_protocol;
 
     if (ngx_http_set_exten(sr) != NGX_OK) {


More information about the nginx mailing list