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