Rejecting requests with duplicate "Content-Length".
This commit is contained in:
@@ -83,6 +83,8 @@ nxt_http_request_content_length(void *ctx, nxt_http_field_t *field,
|
|||||||
nxt_http_request_t *r;
|
nxt_http_request_t *r;
|
||||||
|
|
||||||
r = ctx;
|
r = ctx;
|
||||||
|
|
||||||
|
if (nxt_fast_path(r->content_length == NULL)) {
|
||||||
r->content_length = field;
|
r->content_length = field;
|
||||||
|
|
||||||
n = nxt_off_t_parse(field->value, field->value_length);
|
n = nxt_off_t_parse(field->value, field->value_length);
|
||||||
@@ -91,6 +93,7 @@ nxt_http_request_content_length(void *ctx, nxt_http_field_t *field,
|
|||||||
r->content_length_n = n;
|
r->content_length_n = n;
|
||||||
return NXT_OK;
|
return NXT_OK;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NXT_ERROR;
|
return NXT_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,7 +198,6 @@ a
|
|||||||
'Host': 'localhost'
|
'Host': 'localhost'
|
||||||
}, body='X' * 1000)['status'], 400, 'Content-Length multiple value')
|
}, body='X' * 1000)['status'], 400, 'Content-Length multiple value')
|
||||||
|
|
||||||
@unittest.expectedFailure
|
|
||||||
def test_http_header_content_length_multiple_fields(self):
|
def test_http_header_content_length_multiple_fields(self):
|
||||||
self.load('empty')
|
self.load('empty')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user