comparison src/http/ngx_http_request_body.c @ 4937:3b6594a2b79f

Request body: block write events while reading body. If write events are not blocked, an extra write event might happen for various reasons (e.g. as a result of a http pipelining), resulting in incorrect body being passed to a post handler. The problem manifested itself with the dav module only, as this is the only module which reads the body from a content phase handler (in contrast to exclusive content handlers like proxy). Additionally, dav module used to dump core in such situations due to ticket #238. See reports here: http://mailman.nginx.org/pipermail/nginx-devel/2012-November/002981.html http://serverfault.com/questions/449195/nginx-webdav-server-with-auth-request
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 26 Nov 2012 18:01:49 +0000
parents 240e3fb392c9
children 43cb2c9799c1
comparison
equal deleted inserted replaced
4936:240e3fb392c9 4937:3b6594a2b79f
103 { 103 {
104 /* the whole request body may be placed in r->header_in */ 104 /* the whole request body may be placed in r->header_in */
105 105
106 rb->buf = r->header_in; 106 rb->buf = r->header_in;
107 r->read_event_handler = ngx_http_read_client_request_body_handler; 107 r->read_event_handler = ngx_http_read_client_request_body_handler;
108 r->write_event_handler = ngx_http_request_empty_handler;
108 109
109 rc = ngx_http_do_read_client_request_body(r); 110 rc = ngx_http_do_read_client_request_body(r);
110 goto done; 111 goto done;
111 } 112 }
112 113
164 rc = NGX_HTTP_INTERNAL_SERVER_ERROR; 165 rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
165 goto done; 166 goto done;
166 } 167 }
167 168
168 r->read_event_handler = ngx_http_read_client_request_body_handler; 169 r->read_event_handler = ngx_http_read_client_request_body_handler;
170 r->write_event_handler = ngx_http_request_empty_handler;
169 171
170 rc = ngx_http_do_read_client_request_body(r); 172 rc = ngx_http_do_read_client_request_body(r);
171 173
172 done: 174 done:
173 175