I do not know if it is a bug or design intention: if request body client sent is larger than the amount Content-Length specified . The addition data is also received and dealt in an incorrect way.<br><br>If content-length is smaller :<br>
1) sending a PUT request to webdav module, addition data is written also in to file.<br><br>2) proxy module behave wrongly, it closes client connection.<br><br>To avoid such problems:<br><br>@@ -1,4 +1,3 @@<br>-<br> /*<br>
* Copyright (C) Igor Sysoev<br> */<br>@@ -133,9 +132,12 @@ ngx_http_read_client_request_body(ngx_ht<br> rb->buf = b;<br> <br> if ((off_t) preread >= r->headers_in.content_length_n) {<br>-<br> /* the whole request body was pre-read */<br>
<br>+ b->last = b->pos + r->headers_in.content_length_n;<br>+ preread = r->headers_in.content_length_n;<br>+<br>+<br> r->header_in->pos += (size_t) r->headers_in.content_length_n;<br>
r->request_length += r->headers_in.content_length_n;<br> <br>@@ -267,8 +269,17 @@ ngx_http_do_read_client_request_body(ngx<br> ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,<br> "http read client request body");<br>
<br>+<br> for ( ;; ) {<br>- for ( ;; ) {<br>+ if (rb->rest == 0) {<br>+ /* dicard */<br>+ char buf[1024];<br>+ n = 1;<br>+ while (n > 0)<br>+ n = c->recv(c, buf, 1024);<br>
+ return NGX_OK;<br>+ }<br>+ for ( ;rb->rest != 0; ) {<br> if (rb->buf->last == rb->buf->end) {<br> <br> if (ngx_http_write_request_body(r, rb->to_write) != NGX_OK) {<br>
<br><br><br clear="all"><br>-- <br>要了几天饱饭就不记得西北风啥味了<br>