http: do not default to chunked encoding for TRACE

Fixes: https://github.com/nodejs/node/issues/25783

PR-URL: https://github.com/nodejs/node/pull/27673
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Luigi Pinca 2019-05-13 13:00:17 +02:00 committed by Anna Henningsen
parent 6f7e8b4521
commit 4fc0238a66
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9
2 changed files with 3 additions and 1 deletions

View File

@ -180,6 +180,7 @@ function ClientRequest(input, options, cb) {
method === 'HEAD' ||
method === 'DELETE' ||
method === 'OPTIONS' ||
method === 'TRACE' ||
method === 'CONNECT') {
this.useChunkedEncodingByDefault = false;
} else {

View File

@ -31,7 +31,8 @@ const expectedHeaders = {
'HEAD': ['host', 'connection'],
'OPTIONS': ['host', 'connection'],
'POST': ['host', 'connection', 'content-length'],
'PUT': ['host', 'connection', 'content-length']
'PUT': ['host', 'connection', 'content-length'],
'TRACE': ['host', 'connection']
};
const expectedMethods = Object.keys(expectedHeaders);