FastLED 3.9.15
Loading...
Searching...
No Matches

◆ parseBody()

void fl::HttpResponseParser::parseBody ( )
private

Definition at line 455 of file http_parser.cpp.hpp.

455 {
456 if (mIsChunked) {
457 // Feed buffer to chunked reader
458 if (!mBuffer.empty()) {
459 mChunkedReader->feed(mBuffer);
460 mBuffer.clear();
461 }
462
463 // Read all available chunks
464 while (mChunkedReader->hasChunk()) {
465 size_t chunkSz = mChunkedReader->nextChunkSize();
466 size_t offset = resp().body.size();
467 resp().body.resize(offset + chunkSz);
468 auto result = mChunkedReader->readChunk(
469 fl::span<u8>(resp().body.data() + offset, chunkSz));
470 (void)result;
471 }
472
473 // Check if final chunk received
474 if (mChunkedReader->isFinal()) {
476 }
477 } else {
478 // Read Content-Length bytes
479 if (mBuffer.size() >= mContentLength) {
480 resp().body.insert(resp().body.end(),
481 mBuffer.begin(),
482 mBuffer.begin() + mContentLength);
485 }
486 }
487}
HttpResponse & resp()
fl::vector< u8 > mBuffer
fl::shared_ptr< net::http::ChunkedReader > mChunkedReader
fl::size size() const FL_NOEXCEPT
bool insert(iterator pos, const T &value) FL_NOEXCEPT
Definition vector.h:742
void resize(fl::size n) FL_NOEXCEPT
Definition vector.h:593
fl::UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31
fl::vector< u8 > body
Definition http_parser.h:32

References fl::HttpResponse::body, COMPLETE, consume(), fl::vector< T >::insert(), mBuffer, mChunkedReader, mContentLength, mIsChunked, mState, offset(), fl::vector< T >::resize(), resp(), and fl::vector_basic::size().

Referenced by feed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: