Mercurial > hg > nginx
comparison src/http/modules/ngx_http_static_module.c @ 2322:d4df1c875351 stable-0.6
r2183, r2192 merge:
*) allow file existence test for POST requests in static module
*) do not discard body while error_page redirection
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 20 Nov 2008 17:07:22 +0000 |
parents | 0b5b94805d26 |
children | 2eaf0d8f2990 |
comparison
equal
deleted
inserted
replaced
2321:2577098d65ac | 2322:d4df1c875351 |
---|---|
56 ngx_buf_t *b; | 56 ngx_buf_t *b; |
57 ngx_chain_t out; | 57 ngx_chain_t out; |
58 ngx_open_file_info_t of; | 58 ngx_open_file_info_t of; |
59 ngx_http_core_loc_conf_t *clcf; | 59 ngx_http_core_loc_conf_t *clcf; |
60 | 60 |
61 if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) { | 61 if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD|NGX_HTTP_POST))) { |
62 return NGX_HTTP_NOT_ALLOWED; | 62 return NGX_HTTP_NOT_ALLOWED; |
63 } | 63 } |
64 | 64 |
65 if (r->uri.data[r->uri.len - 1] == '/') { | 65 if (r->uri.data[r->uri.len - 1] == '/') { |
66 return NGX_DECLINED; | 66 return NGX_DECLINED; |
67 } | 67 } |
68 | 68 |
69 /* TODO: Win32 */ | 69 /* TODO: Win32 */ |
70 if (r->zero_in_uri) { | 70 if (r->zero_in_uri) { |
71 return NGX_DECLINED; | 71 return NGX_DECLINED; |
72 } | |
73 | |
74 rc = ngx_http_discard_request_body(r); | |
75 | |
76 if (rc != NGX_OK) { | |
77 return rc; | |
78 } | 72 } |
79 | 73 |
80 log = r->connection->log; | 74 log = r->connection->log; |
81 | 75 |
82 /* | 76 /* |
184 return NGX_HTTP_NOT_FOUND; | 178 return NGX_HTTP_NOT_FOUND; |
185 } | 179 } |
186 | 180 |
187 #endif | 181 #endif |
188 | 182 |
183 if (r->method & NGX_HTTP_POST) { | |
184 return NGX_HTTP_NOT_ALLOWED; | |
185 } | |
186 | |
187 rc = ngx_http_discard_request_body(r); | |
188 | |
189 if (rc != NGX_OK) { | |
190 return rc; | |
191 } | |
192 | |
189 log->action = "sending response to client"; | 193 log->action = "sending response to client"; |
190 | 194 |
191 r->headers_out.status = NGX_HTTP_OK; | 195 r->headers_out.status = NGX_HTTP_OK; |
192 r->headers_out.content_length_n = of.size; | 196 r->headers_out.content_length_n = of.size; |
193 r->headers_out.last_modified_time = of.mtime; | 197 r->headers_out.last_modified_time = of.mtime; |