From b5d4fc939edca5ea5858b66d5fcf789b660df243 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Fri, 28 Sep 2018 17:32:02 +0300 Subject: Disabled chunked transfer encoding for 204 responses. --- src/nxt_h1proto.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nxt_h1proto.c') diff --git a/src/nxt_h1proto.c b/src/nxt_h1proto.c index 3e5044b7..70d6e5d8 100644 --- a/src/nxt_h1proto.c +++ b/src/nxt_h1proto.c @@ -967,7 +967,8 @@ nxt_h1p_request_header_send(nxt_task_t *task, nxt_http_request_t *r) http11 = (h1p->parser.version.s.minor != '0'); if (r->resp.content_length == NULL || r->resp.content_length->skip) { - if (http11) { + + if (http11 && n != NXT_HTTP_NO_CONTENT) { h1p->chunked = 1; size += nxt_length(chunked); /* Trailing CRLF will be added by the first chunk header. */ -- cgit From 3c2eddb183684e577bca967543a52067edbda9a5 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Mon, 1 Oct 2018 15:06:31 +0300 Subject: Allowing keep-alive connections after 204 responses. This was unintentionally disabled by 7b5026a0bdeb. --- src/nxt_h1proto.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/nxt_h1proto.c') diff --git a/src/nxt_h1proto.c b/src/nxt_h1proto.c index 70d6e5d8..ed159c93 100644 --- a/src/nxt_h1proto.c +++ b/src/nxt_h1proto.c @@ -968,11 +968,13 @@ nxt_h1p_request_header_send(nxt_task_t *task, nxt_http_request_t *r) if (r->resp.content_length == NULL || r->resp.content_length->skip) { - if (http11 && n != NXT_HTTP_NO_CONTENT) { - h1p->chunked = 1; - size += nxt_length(chunked); - /* Trailing CRLF will be added by the first chunk header. */ - size -= nxt_length("\r\n"); + if (http11) { + if (n != NXT_HTTP_NO_CONTENT) { + h1p->chunked = 1; + size += nxt_length(chunked); + /* Trailing CRLF will be added by the first chunk header. */ + size -= nxt_length("\r\n"); + } } else { h1p->keepalive = 0; -- cgit From d54d806c52756ab65d61713589029627ffa72c5d Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Mon, 1 Oct 2018 15:06:31 +0300 Subject: Disabled chunked transfer encoding for 304 responses as well. According to RFC 7232: | A 304 response cannot contain a message-body; it is always terminated | by the first empty line after the header fields. --- src/nxt_h1proto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nxt_h1proto.c') diff --git a/src/nxt_h1proto.c b/src/nxt_h1proto.c index ed159c93..2194e56f 100644 --- a/src/nxt_h1proto.c +++ b/src/nxt_h1proto.c @@ -969,7 +969,7 @@ nxt_h1p_request_header_send(nxt_task_t *task, nxt_http_request_t *r) if (r->resp.content_length == NULL || r->resp.content_length->skip) { if (http11) { - if (n != NXT_HTTP_NO_CONTENT) { + if (n != NXT_HTTP_NOT_MODIFIED && n != NXT_HTTP_NO_CONTENT) { h1p->chunked = 1; size += nxt_length(chunked); /* Trailing CRLF will be added by the first chunk header. */ -- cgit