Welcome! Log In Create A New Profile

Advanced

[PATCH 1 of 5] Fix incorrect 201 replies from dav module

Maxim Dounin
November 02, 2010 12:02AM
# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1288669810 -10800
# Node ID 1e3045c3de6be5718359f4e0e3af9007f3da50aa
# Parent 94ea26a3b3aac367dc08ef9ef6c71f9ab8effa09
Fix incorrect 201 replies from dav module.

Replies with 201 code contain body, and we should clearly indicate it's
empty if it's empty. Before 0.8.32 chunked was explicitly disabled for
201 replies and as a result empty body was indicated by connection close
(not perfect, but worked). Since 0.8.32 chunked is enabled, and this
causes incorrect responses from dav module when HTTP/1.1 is used: with
"Transfer-Encoding: chunked" but no chunks at all.

Fix is to actually return empty body in special reponse handler instead
of abusing r->header_only flag.

See here for initial report:

http://nginx.org/pipermail/nginx-ru/2010-October/037535.html

diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c
--- a/src/http/ngx_http_special_response.c
+++ b/src/http/ngx_http_special_response.c
@@ -410,7 +410,6 @@ ngx_http_special_response_handler(ngx_ht
if (error == NGX_HTTP_CREATED) {
/* 201 */
err = 0;
- r->header_only = 1;

} else if (error == NGX_HTTP_NO_CONTENT) {
/* 204 */
@@ -617,7 +616,7 @@ ngx_http_send_special_response(ngx_http_
r->headers_out.content_type_lowcase = NULL;

} else {
- r->headers_out.content_length_n = -1;
+ r->headers_out.content_length_n = 0;
}

if (r->headers_out.content_length) {
@@ -635,7 +634,7 @@ ngx_http_send_special_response(ngx_http_
}

if (ngx_http_error_pages[err].len == 0) {
- return NGX_OK;
+ return ngx_http_send_special(r, NGX_HTTP_LAST);
}

b = ngx_calloc_buf(r->pool);

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH 1 of 5] Fix incorrect 201 replies from dav module

Maxim Dounin 1359 November 02, 2010 12:02AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 75
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready