Disabled chunked transfer encoding for 204 responses.

This commit is contained in:
Igor Sysoev
2018-09-28 17:32:02 +03:00
parent 92da8dae1e
commit b5d4fc939e
3 changed files with 3 additions and 2 deletions

View File

@@ -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. */

View File

@@ -12,6 +12,7 @@ typedef enum {
NXT_HTTP_INVALID = 0,
NXT_HTTP_OK = 200,
NXT_HTTP_NO_CONTENT = 204,
NXT_HTTP_MULTIPLE_CHOICES = 300,
NXT_HTTP_MOVED_PERMANENTLY = 301,

View File

@@ -60,7 +60,6 @@ class TestUnitPythonApplication(unit.TestUnitApplicationPython):
self.assertEqual(self.get()['headers']['Server-Port'], '7080',
'Server-Port header')
@unittest.expectedFailure
def test_python_application_204_transfer_encoding(self):
self.load('204_no_content')