(abort, body, client, request, socket, contentLength, header, expectsPayload)
| 8047 | } |
| 8048 | __name(writeStream, "writeStream"); |
| 8049 | function writeBuffer(abort, body, client, request, socket, contentLength, header, expectsPayload) { |
| 8050 | try { |
| 8051 | if (!body) { |
| 8052 | if (contentLength === 0) { |
| 8053 | socket.write(`${header}content-length: 0\r |
| 8054 | \r |
| 8055 | `, "latin1"); |
| 8056 | } else { |
| 8057 | assert(contentLength === null, "no body must not have content length"); |
| 8058 | socket.write(`${header}\r |
| 8059 | `, "latin1"); |
| 8060 | } |
| 8061 | } else if (util.isBuffer(body)) { |
| 8062 | assert(contentLength === body.byteLength, "buffer body must have content length"); |
| 8063 | socket.cork(); |
| 8064 | socket.write(`${header}content-length: ${contentLength}\r |
| 8065 | \r |
| 8066 | `, "latin1"); |
| 8067 | socket.write(body); |
| 8068 | socket.uncork(); |
| 8069 | request.onBodySent(body); |
| 8070 | if (!expectsPayload && request.reset !== false) { |
| 8071 | socket[kReset] = true; |
| 8072 | } |
| 8073 | } |
| 8074 | request.onRequestSent(); |
| 8075 | client[kResume](); |
| 8076 | } catch (err) { |
| 8077 | abort(err); |
| 8078 | } |
| 8079 | } |
| 8080 | __name(writeBuffer, "writeBuffer"); |
| 8081 | async function writeBlob(abort, body, client, request, socket, contentLength, header, expectsPayload) { |
| 8082 | try { |
no test coverage detected
searching dependent graphs…