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

◆ parseBody()

void fl::HttpRequestParser::parseBody ( )
private

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

220 {
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()) {
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);
250 }
251 }
252}
HttpRequest & req()
Definition http_parser.h:81
fl::shared_ptr< net::http::ChunkedReader > mChunkedReader
Definition http_parser.h:77
fl::vector< u8 > mBuffer
Definition http_parser.h:75
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:23

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

Referenced by feed().

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