()
| 54438 | util4.destroy(socket, new ResponseExceededMaxSizeError()); |
| 54439 | return -1; |
| 54440 | } |
| 54441 | this.bytesRead += buf.length; |
| 54442 | if (request3.onData(buf) === false) { |
| 54443 | return constants3.ERROR.PAUSED; |
| 54444 | } |
| 54445 | } |
| 54446 | onMessageComplete() { |
| 54447 | const { client, socket, statusCode, upgrade, headers, contentLength, bytesRead, shouldKeepAlive } = this; |
| 54448 | if (socket.destroyed && (!statusCode || shouldKeepAlive)) { |
| 54449 | return -1; |
| 54450 | } |
| 54451 | if (upgrade) { |
| 54452 | return; |
| 54453 | } |
| 54454 | const request3 = client[kQueue][client[kRunningIdx]]; |
| 54455 | assert2(request3); |
| 54456 | assert2(statusCode >= 100); |
| 54457 | this.statusCode = null; |
| 54458 | this.statusText = ""; |
| 54459 | this.bytesRead = 0; |
| 54460 | this.contentLength = ""; |
| 54461 | this.keepAlive = ""; |
| 54462 | this.connection = ""; |
| 54463 | assert2(this.headers.length % 2 === 0); |
| 54464 | this.headers = []; |
| 54465 | this.headersSize = 0; |
| 54466 | if (statusCode < 200) { |
| 54467 | return; |
| 54468 | } |
| 54469 | if (request3.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { |
| 54470 | util4.destroy(socket, new ResponseContentLengthMismatchError()); |
| 54471 | return -1; |
| 54472 | } |
| 54473 | request3.onComplete(headers); |
| 54474 | client[kQueue][client[kRunningIdx]++] = null; |
| 54475 | if (socket[kWriting]) { |
| 54476 | assert2.strictEqual(client[kRunning], 0); |
| 54477 | util4.destroy(socket, new InformationalError("reset")); |
| 54478 | return constants3.ERROR.PAUSED; |
| 54479 | } else if (!shouldKeepAlive) { |
| 54480 | util4.destroy(socket, new InformationalError("reset")); |
| 54481 | return constants3.ERROR.PAUSED; |
| 54482 | } else if (socket[kReset] && client[kRunning] === 0) { |
| 54483 | util4.destroy(socket, new InformationalError("reset")); |
| 54484 | return constants3.ERROR.PAUSED; |
| 54485 | } else if (client[kPipelining] === 1) { |
| 54486 | setImmediate(resume2, client); |
| 54487 | } else { |
no test coverage detected