static POST

Igor Sysoev is at rambler-co.ru
Mon Aug 18 22:16:08 MSD 2008


On Mon, Aug 18, 2008 at 07:07:27PM +0100, Igor Clark wrote:

> I've applied the patch to a fresh copy of 0.6.32 and I'm having the  
> same problems POSTing to named locations.
> 
> Configuration:
> 
> 	location / {
> 		index   index.php;
> 		error_page  404 =   @phpapp;
> 	}
> 
> 	location @phpapp {
> 		fastcgi_pass		127.0.0.1:9000;
> 		fastcgi_index	index.php;
> 		fastcgi_param	SCRIPT_FILENAME  $document_root/test.php;
> 		fastcgi_param	SCRIPT_URL  $fastcgi_script_name;	# 
> 		for use in  particular PHP framework
> 		include			fastcgi_params;
> 	}
> 
> Form:
> 
> 	<form method="GET" action="/blah"> <input type="text" name="value">  
> <input type="submit"> </form>
> 
> PHP script:
> 
> 	<pre><?	print_r($_SERVER); ?></pre>
> 
> This configuration works as expected. When I change the form method to  
> POST
> 
> 	<form method="POST" action="/blah"> <input type="text" name="value"> 
> <input type="submit"> </form>
> 
> and submit the form, the client hangs, and I get the attached debug  
> from nginx, the connection only apparently closing because I press the  
> browser's "stop" button, and an internal nginx 499 is generated.
> 
> Any ideas what's happening?

Try attached additional patch.


-- 
Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
Index: src/http/ngx_http_special_response.c
===================================================================
--- src/http/ngx_http_special_response.c	(revision 1510)
+++ src/http/ngx_http_special_response.c	(working copy)
@@ -336,12 +336,6 @@
                    "http special response: %d, \"%V?%V\"",
                    error, &r->uri, &r->args);
 
-    rc = ngx_http_discard_request_body(r);
-
-    if (rc == NGX_HTTP_INTERNAL_SERVER_ERROR) {
-        error = NGX_HTTP_INTERNAL_SERVER_ERROR;
-    }
-
     r->err_status = error;
 
     if (r->keepalive) {
@@ -386,6 +380,12 @@
         }
     }
 
+    rc = ngx_http_discard_request_body(r);
+
+    if (rc == NGX_HTTP_INTERNAL_SERVER_ERROR) {
+        error = NGX_HTTP_INTERNAL_SERVER_ERROR;
+    }
+
     if (clcf->msie_refresh
         && r->headers_in.msie
         && (error == NGX_HTTP_MOVED_PERMANENTLY


More information about the nginx mailing list