From e338e748eb33d4c540b67e88f3afd889559ceb40 Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Fri, 5 Nov 2010 04:31:56 -0700 Subject: [PATCH] Removed Content-Length for chunked --- lib/express/response.js | 2 -- test/response.test.js | 9 +++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/express/response.js b/lib/express/response.js index 6d3b5c02ed..057c27cfa2 100644 --- a/lib/express/response.js +++ b/lib/express/response.js @@ -166,10 +166,8 @@ http.ServerResponse.prototype.sendfile = function(path, fn){ + end + '/' + stat.size); - self.header('Content-Length', end - start + 1); } else { var stream = fs.createReadStream(path); - self.header('Content-Length', stat.size); } self.contentType(path); self.header('Accept-Ranges', 'bytes'); diff --git a/test/response.test.js b/test/response.test.js index 1ecf585f27..488534d364 100644 --- a/test/response.test.js +++ b/test/response.test.js @@ -243,7 +243,7 @@ module.exports = { { body: 'Internal Server Error', status: 500 }); assert.response(app, { url: '/large.json' }, - { status: 200, headers: { 'Content-Length': 2535, 'Content-Type': 'application/json' }}); + { status: 200, headers: { 'Content-Type': 'application/json' }}); }, 'test #sendfile() Accept-Ranges': function(assert){ @@ -277,7 +277,6 @@ module.exports = { { url: '/large.json', headers: { 'Range': 'bytes=0-499' }}, { headers: { 'Content-Type': 'application/json', - 'Content-Length': 500, 'Content-Range': 'bytes 0-499/2535' }, status: 206 }); }, @@ -296,8 +295,7 @@ module.exports = { assert.response(app, { url: '/large.json', headers: { 'Range': 'basdytes=asdf' }}, { headers: { - 'Content-Type': 'application/json', - 'Content-Length': 2535 + 'Content-Type': 'application/json' }, status: 200 }); }, @@ -315,8 +313,7 @@ module.exports = { assert.response(app, { url: '/large.json', headers: { 'Range': 'bytes=500-10' }}, { headers: { - 'Content-Type': 'application/json', - 'Content-Length': 2535 + 'Content-Type': 'application/json' }, status: 200 }); },