| 837 | } |
| 838 | |
| 839 | Result HttpOutgoingMessage::ChunkedWritableStream::asyncWrite(AsyncBufferView::ID bufferID, |
| 840 | Function<void(AsyncBufferView::ID)> cb) |
| 841 | { |
| 842 | SC_TRY_MSG(destination != nullptr, "HttpOutgoingMessage chunked destination missing"); |
| 843 | |
| 844 | Span<const char> body; |
| 845 | SC_TRY(getBuffersPool().getReadableData(bufferID, body)); |
| 846 | |
| 847 | StringSpan header; |
| 848 | SC_TRY(scHttpFormatChunkHeader(static_cast<uint64_t>(body.sizeInBytes()), headerStorage, header)); |
| 849 | |
| 850 | currentBodyBufferID = bufferID; |
| 851 | currentBodyCallback = move(cb); |
| 852 | getBuffersPool().refBuffer(bufferID); |
| 853 | return destination->write(AsyncBufferView(header.toCharSpan()), |
| 854 | {[this](AsyncBufferView::ID writtenBufferID) { onChunkHeaderWritten(writtenBufferID); }}); |
| 855 | } |
| 856 | |
| 857 | bool HttpOutgoingMessage::ChunkedWritableStream::canEndWritable() |
| 858 | { |
nothing calls this directly
no test coverage detected