From 9d9893a0f23c6bec9d0d4affa7a4eb67ccac6bac Mon Sep 17 00:00:00 2001 From: Sidd Sridharan Date: Sat, 3 Dec 2016 21:07:26 -0800 Subject: [PATCH] parse params.left = 0 properly --- lib/server/parse-http.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/server/parse-http.js b/lib/server/parse-http.js index 9e83a59..24c3c69 100644 --- a/lib/server/parse-http.js +++ b/lib/server/parse-http.js @@ -24,7 +24,9 @@ function parseHttpRequest (req, opts) { params.port = Number(params.port) if (!params.port) throw new Error('invalid port') - params.left = Number(params.left) || Infinity + params.left = Number(params.left) + if (isNaN(params.left)) params.left = Infinity + params.compact = Number(params.compact) || 0 params.numwant = Math.min( Number(params.numwant) || common.DEFAULT_ANNOUNCE_PEERS,