Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_static_module.c @ 2182:23309bcd9937
allow file existence test for POST requests in static module
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 17 Aug 2008 17:42:42 +0000 |
parents | 25add486e7aa |
children | 8564129d49b6 |
comparison
equal
deleted
inserted
replaced
2181:774bef502c78 | 2182:23309bcd9937 |
---|---|
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 /* |
201 return NGX_HTTP_NOT_FOUND; | 195 return NGX_HTTP_NOT_FOUND; |
202 } | 196 } |
203 | 197 |
204 #endif | 198 #endif |
205 | 199 |
200 if (r->method & NGX_HTTP_POST) { | |
201 return NGX_HTTP_NOT_ALLOWED; | |
202 } | |
203 | |
204 rc = ngx_http_discard_request_body(r); | |
205 | |
206 if (rc != NGX_OK) { | |
207 return rc; | |
208 } | |
209 | |
206 log->action = "sending response to client"; | 210 log->action = "sending response to client"; |
207 | 211 |
208 r->headers_out.status = NGX_HTTP_OK; | 212 r->headers_out.status = NGX_HTTP_OK; |
209 r->headers_out.content_length_n = of.size; | 213 r->headers_out.content_length_n = of.size; |
210 r->headers_out.last_modified_time = of.mtime; | 214 r->headers_out.last_modified_time = of.mtime; |