]> git.kaiwu.me - nginx.git/commitdiff
allow file existence test for POST requests in static module
authorIgor Sysoev <igor@sysoev.ru>
Sun, 17 Aug 2008 17:42:42 +0000 (17:42 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Sun, 17 Aug 2008 17:42:42 +0000 (17:42 +0000)
src/http/modules/ngx_http_static_module.c

index 8d399fccd365c20c6798cdde2054d82c600f8ade..7c2768d81d1e4246bd623fb0164374d1dc61a681 100644 (file)
@@ -58,7 +58,7 @@ ngx_http_static_handler(ngx_http_request_t *r)
     ngx_open_file_info_t       of;
     ngx_http_core_loc_conf_t  *clcf;
 
-    if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {
+    if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD|NGX_HTTP_POST))) {
         return NGX_HTTP_NOT_ALLOWED;
     }
 
@@ -71,12 +71,6 @@ ngx_http_static_handler(ngx_http_request_t *r)
         return NGX_DECLINED;
     }
 
-    rc = ngx_http_discard_request_body(r);
-
-    if (rc != NGX_OK) {
-        return rc;
-    }
-
     log = r->connection->log;
 
     /*
@@ -203,6 +197,16 @@ ngx_http_static_handler(ngx_http_request_t *r)
 
 #endif
 
+    if (r->method & NGX_HTTP_POST) {
+        return NGX_HTTP_NOT_ALLOWED;
+    }
+
+    rc = ngx_http_discard_request_body(r);
+
+    if (rc != NGX_OK) {
+        return rc;
+    }
+
     log->action = "sending response to client";
 
     r->headers_out.status = NGX_HTTP_OK;