From a19176fe8afc0f38b2a846fac61ad421481358db Mon Sep 17 00:00:00 2001 From: Chia-liang Kao Date: Wed, 4 Mar 2015 21:57:49 +0800 Subject: [PATCH 1/2] correct dlna flag and remove duplicated header assignment --- index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/index.js b/index.js index f144b18..1ab1201 100644 --- a/index.js +++ b/index.js @@ -128,7 +128,7 @@ var createServer = function (e, opts) { response.setHeader('Accept-Ranges', 'bytes') response.setHeader('Content-Type', getType(file.name)) response.setHeader('transferMode.dlna.org', 'Streaming') - response.setHeader('contentFeatures.dlna.org', 'DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=017000 00000000000000000000000000') + response.setHeader('contentFeatures.dlna.org', 'DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000') if (!range) { response.setHeader('Content-Length', file.length) if (request.method === 'HEAD') return response.end() @@ -139,8 +139,6 @@ var createServer = function (e, opts) { response.statusCode = 206 response.setHeader('Content-Length', range.end - range.start + 1) response.setHeader('Content-Range', 'bytes ' + range.start + '-' + range.end + '/' + file.length) - response.setHeader('transferMode.dlna.org', 'Streaming') - response.setHeader('contentFeatures.dlna.org', 'DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=017000 00000000000000000000000000') if (request.method === 'HEAD') return response.end() pump(file.createReadStream(range), response) }) From 21e68d92f113da5c1e0129478499bdcc1af0efc6 Mon Sep 17 00:00:00 2001 From: Chia-liang Kao Date: Wed, 4 Mar 2015 21:59:43 +0800 Subject: [PATCH 2/2] allow onResponse hook to add more headers --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 1ab1201..c0b81c4 100644 --- a/index.js +++ b/index.js @@ -129,6 +129,7 @@ var createServer = function (e, opts) { response.setHeader('Content-Type', getType(file.name)) response.setHeader('transferMode.dlna.org', 'Streaming') response.setHeader('contentFeatures.dlna.org', 'DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000') + if (opts.onResponse) opts.onResponse(response) if (!range) { response.setHeader('Content-Length', file.length) if (request.method === 'HEAD') return response.end()