MCPcopy Create free account
hub / github.com/LUX-Core/lux / Chunk

Method Chunk

src/httpserver.cpp:667–690  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

665}
666
667void HTTPRequest::Chunk(const std::string& chunk) {
668 assert(!replySent);
669
670 int status = 200;
671
672 if (!startedChunkTransfer) {
673 HTTPEvent* ev = new HTTPEvent(eventBase, true, NULL,
674 std::bind(evhttp_send_reply_start, req, status,
675 (const char*) NULL));
676 ev->trigger(0);
677
678 startDetectClientClose();
679 startedChunkTransfer = true;
680 }
681
682
683 if (chunk.size() > 0) {
684 auto databuf = evbuffer_new(); // HTTPEvent will free this buffer
685 evbuffer_add(databuf, chunk.data(), chunk.size());
686 HTTPEvent* ev = new HTTPEvent(eventBase, true, databuf,
687 std::bind(evhttp_send_reply_chunk, req, databuf));
688 ev->trigger(0);
689 }
690}
691
692/** Closure sent to main thread to request a reply to be sent to
693 * a HTTP request.

Callers 4

JSONErrorReplyFunction · 0.80
PollStartMethod · 0.80
PollPingMethod · 0.80
PollReplyMethod · 0.80

Calls 3

triggerMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected