From 7452e9ef7378b8b8935bcd8946849e079c1b2b59 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Wed, 29 Jul 2020 10:49:29 +0200 Subject: [PATCH] fix: ignore headers timeout after statusCode Refs: https://github.com/mcollina/undici/issues/268 --- lib/client.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/client.js b/lib/client.js index 16130d49b25..5f684fd79ea 100644 --- a/lib/client.js +++ b/lib/client.js @@ -382,6 +382,10 @@ class Parser extends HTTPParser { } [HTTPParser.kOnTimeout] () { + if (this.statusCode) { + // https://github.com/mcollina/undici/issues/268 + return + } util.destroy(this.socket, new HeadersTimeoutError()) } @@ -457,13 +461,13 @@ class Parser extends HTTPParser { assert(statusCode >= 100) + this.statusCode = null + this.headers = null + if (statusCode < 200) { return } - this.statusCode = null - this.headers = null - request.onComplete(headers) this.read = 0