()
| 6380 | this.statusCode = statusCode; |
| 6381 | this.shouldKeepAlive = shouldKeepAlive || // Override llhttp value which does not allow keepAlive for HEAD. |
| 6382 | request.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; |
| 6383 | if (this.statusCode >= 200) { |
| 6384 | const bodyTimeout = request.bodyTimeout != null ? request.bodyTimeout : client[kBodyTimeout]; |
| 6385 | this.setTimeout(bodyTimeout, TIMEOUT_BODY); |
| 6386 | } else if (this.timeout) { |
| 6387 | if (this.timeout.refresh) { |
| 6388 | this.timeout.refresh(); |
| 6389 | } |
| 6390 | } |
| 6391 | if (request.method === "CONNECT") { |
| 6392 | assert(client[kRunning] === 1); |
| 6393 | this.upgrade = true; |
| 6394 | return 2; |
| 6395 | } |
| 6396 | if (upgrade) { |
| 6397 | assert(client[kRunning] === 1); |
| 6398 | this.upgrade = true; |
| 6399 | return 2; |
| 6400 | } |
| 6401 | assert((this.headers.length & 1) === 0); |
| 6402 | this.headers = []; |
| 6403 | this.headersSize = 0; |
| 6404 | if (this.shouldKeepAlive && client[kPipelining]) { |
| 6405 | const keepAliveTimeout = this.keepAlive ? util.parseKeepAliveTimeout(this.keepAlive) : null; |
| 6406 | if (keepAliveTimeout != null) { |
| 6407 | const timeout = Math.min( |
| 6408 | keepAliveTimeout - client[kKeepAliveTimeoutThreshold], |
| 6409 | client[kKeepAliveMaxTimeout] |
| 6410 | ); |
| 6411 | if (timeout <= 0) { |
| 6412 | socket[kReset] = true; |
| 6413 | } else { |
| 6414 | client[kKeepAliveTimeoutValue] = timeout; |
| 6415 | } |
| 6416 | } else { |
| 6417 | client[kKeepAliveTimeoutValue] = client[kKeepAliveDefaultTimeout]; |
| 6418 | } |
| 6419 | } else { |
| 6420 | socket[kReset] = true; |
| 6421 | } |
| 6422 | const pause = request.onHeaders(statusCode, headers, this.resume, statusText) === false; |
| 6423 | if (request.aborted) { |
| 6424 | return -1; |
| 6425 | } |
| 6426 | if (request.method === "HEAD") { |
| 6427 | return 1; |
| 6428 | } |
| 6429 | if (statusCode < 200) { |
| 6430 | return 1; |
no test coverage detected