static POST
Igor Sysoev
is at rambler-co.ru
Thu Aug 14 16:13:48 MSD 2008
The attached patch allows POSTs to non-existent files.
This allows POSTs in following configuration:
location / {
error_page 404 = @fallback;
}
location @fallback {
...
}
I intended to include it in the next release.
--
Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
Index: src/http/modules/ngx_http_static_module.c
===================================================================
--- src/http/modules/ngx_http_static_module.c (revision 1499)
+++ src/http/modules/ngx_http_static_module.c (working copy)
@@ -58,7 +58,7 @@
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,10 +71,13 @@
return NGX_DECLINED;
}
- rc = ngx_http_discard_request_body(r);
+ if (r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD)) {
- if (rc != NGX_OK) {
- return rc;
+ rc = ngx_http_discard_request_body(r);
+
+ if (rc != NGX_OK) {
+ return rc;
+ }
}
log = r->connection->log;
@@ -203,6 +206,10 @@
#endif
+ if (r->method & NGX_HTTP_POST) {
+ return NGX_HTTP_NOT_ALLOWED;
+ }
+
log->action = "sending response to client";
r->headers_out.status = NGX_HTTP_OK;
More information about the nginx
mailing list