(abort, body, client, request, socket, contentLength, header, expectsPayload)
| 6825 | } else { |
| 6826 | util.destroy(body); |
| 6827 | } |
| 6828 | }; |
| 6829 | body.on("data", onData).on("end", onFinished).on("error", onFinished).on("close", onClose); |
| 6830 | if (body.resume) { |
| 6831 | body.resume(); |
| 6832 | } |
| 6833 | socket.on("drain", onDrain).on("error", onFinished); |
| 6834 | if ((_a = body.errorEmitted) != null ? _a : body.errored) { |
| 6835 | setImmediate(() => onFinished(body.errored)); |
| 6836 | } else if ((_b = body.endEmitted) != null ? _b : body.readableEnded) { |
| 6837 | setImmediate(() => onFinished(null)); |
| 6838 | } |
| 6839 | if ((_c = body.closeEmitted) != null ? _c : body.closed) { |
| 6840 | setImmediate(onClose); |
| 6841 | } |
| 6842 | } |
| 6843 | function writeBuffer(abort, body, client, request, socket, contentLength, header, expectsPayload) { |
| 6844 | try { |
| 6845 | if (!body) { |
| 6846 | if (contentLength === 0) { |
| 6847 | socket.write(`${header}content-length: 0\r |
| 6848 | \r |
| 6849 | `, "latin1"); |
| 6850 | } else { |
| 6851 | assert(contentLength === null, "no body must not have content length"); |
| 6852 | socket.write(`${header}\r |
| 6853 | `, "latin1"); |
| 6854 | } |
| 6855 | } else if (util.isBuffer(body)) { |
| 6856 | assert(contentLength === body.byteLength, "buffer body must have content length"); |
| 6857 | socket.cork(); |
| 6858 | socket.write(`${header}content-length: ${contentLength}\r |
| 6859 | \r |
| 6860 | `, "latin1"); |
no test coverage detected