MCPcopy Create free account
hub / github.com/FastLED/FastLED / parseBody

Method parseBody

src/fl/stl/asio/http/http_parser.cpp.hpp:220–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void HttpRequestParser::parseBody() {
221 if (mIsChunked) {
222 // Feed buffer to chunked reader
223 if (!mBuffer.empty()) {
224 mChunkedReader->feed(mBuffer);
225 mBuffer.clear();
226 }
227
228 // Read all available chunks
229 while (mChunkedReader->hasChunk()) {
230 size_t chunkSz = mChunkedReader->nextChunkSize();
231 size_t offset = req().body.size();
232 req().body.resize(offset + chunkSz);
233 auto result = mChunkedReader->readChunk(
234 fl::span<u8>(req().body.data() + offset, chunkSz));
235 (void)result;
236 }
237
238 // Check if final chunk received
239 if (mChunkedReader->isFinal()) {
240 mState = COMPLETE;
241 }
242 } else {
243 // Read Content-Length bytes
244 if (mBuffer.size() >= mContentLength) {
245 req().body.insert(req().body.end(),
246 mBuffer.begin(),
247 mBuffer.begin() + mContentLength);
248 consume(mContentLength);
249 mState = COMPLETE;
250 }
251 }
252}
253
254fl::optional<size_t> HttpRequestParser::findCRLF() const {
255 for (size_t i = 0; i + 1 < mBuffer.size(); i++) {

Callers

nothing calls this directly

Calls 13

hasChunkMethod · 0.80
nextChunkSizeMethod · 0.80
readChunkMethod · 0.80
emptyMethod · 0.45
feedMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
dataMethod · 0.45
isFinalMethod · 0.45
insertMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected