From 5d9005c35963c3fefc93b607dff75c1471e819d7 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Mon, 3 Dec 2018 10:53:24 +0100 Subject: [PATCH] http: fix backport of Slowloris headers The backport of https://github.com/nodejs/node/commit/618eebdd17 was not complete, and the starting time to parse the headers was not reset. PR-URL: https://github.com/nodejs/node/pull/24796 Fixes: https://github.com/nodejs/node/issues/24760 Reviewed-By: Rod Vagg Reviewed-By: Richard Lau Reviewed-By: Anna Henningsen --- lib/_http_server.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/_http_server.js b/lib/_http_server.js index 54e080717a7567..a224cc795fc13a 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -481,6 +481,9 @@ function connectionListener(socket) { function parserOnIncoming(req, shouldKeepAlive) { incoming.push(req); + // Set to zero to communicate that we have finished parsing. + socket.parser.parsingHeadersStart = 0; + // If the writable end isn't consuming, then stop reading // so that we don't become overwhelmed by a flood of // pipelined requests that may never be resolved.