From a89e2f2688ffbfac53ee89121c8bf067ff43a47e Mon Sep 17 00:00:00 2001 From: indexzero Date: Sat, 9 Mar 2013 02:40:09 -0500 Subject: [PATCH] [fix] Do not use "Transfer-Encoding: chunked" header for proxied DELETE requests with no "Content-Length" header. Fixes #373. --- lib/node-http-proxy/http-proxy.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index 24183943c..05ce750d4 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -253,7 +253,10 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) { } // Remove `Transfer-Encoding` header if client's protocol is HTTP/1.0 - if (req.httpVersion === '1.0') { + // or if this is a DELETE request with no content-length header. + // See: https://github.com/nodejitsu/node-http-proxy/pull/373 + if (req.httpVersion === '1.0' || (req.method === 'DELETE' + && !req.headers['content-length'])) { delete response.headers['transfer-encoding']; }