This repository was archived by the owner on Apr 22, 2023. It is now read-only.
-
-
Couldn't load subscription status.
- Fork 7.3k
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
DELETE client request should not send transfer-encoding: chunked #6185
Copy link
Copy link
Closed
Description
i'm sorry, there seems to be a misunderstanding. this bug is about nodejs client (not server).
in particular, nodejs client will always send a chunked body for DELETE requests. in real world, the client should never send a body for delete's, because it makes no sense. i think its pretty reasonable for servers to not expect chunk encoding in delete requests. in our case, our enterprise service gets confused and the request times out.
the code i posted in the previous bug shows the server printing client request headers. HEAD, DELETE, GET requests should all have the same behavior, but they don't in nodejs.
var http = require('http');
http.createServer(function (request, response) {
console.log([request.method, request.url, request.httpVersion]);
console.log(request.headers);
console.log();
response.end(request.method + ' finished\n');
}).listen(1337);
['HEAD', 'DELETE', 'GET', 'POST', 'PUT'].forEach(function(method) {
http.request({
hostname: 'localhost',
method: method,
path: '/',
port: 1337
}, function (response) { response.pipe(process.stdout, { end: false }); }).end();
});// output
[ 'HEAD', '/', '1.1' ]
{ host: 'localhost:1337', connection: 'keep-alive' }
[ 'DELETE', '/', '1.1' ]
{ host: 'localhost:1337',
connection: 'keep-alive',
'transfer-encoding': 'chunked' }
[ 'GET', '/', '1.1' ]
{ host: 'localhost:1337', connection: 'keep-alive' }
[ 'POST', '/', '1.1' ]
{ host: 'localhost:1337',
connection: 'keep-alive',
'transfer-encoding': 'chunked' }
[ 'PUT', '/', '1.1' ]
{ host: 'localhost:1337',
connection: 'keep-alive',
'transfer-encoding': 'chunked' }