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

Method parseHeaders

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

Source from the content-addressed store, hash-verified

188}
189
190bool HttpRequestParser::parseHeaders() {
191 while (true) {
192 auto crlfPos = findCRLF();
193 if (!crlfPos.has_value()) {
194 return false; // Need more data
195 }
196
197 // Check for empty line (end of headers)
198 if (crlfPos.value() == 0) {
199 consume(2); // Consume final CRLF
200 return true;
201 }
202
203 // Extract header line
204 fl::string line(reinterpret_cast<const char*>(mBuffer.data()), crlfPos.value()); // ok reinterpret cast
205 consume(crlfPos.value() + 2); // +2 for CRLF
206
207 // Parse: "Name: Value"
208 size_t colonPos = line.find(':');
209 if (colonPos == fl::string::npos) {
210 continue; // Skip invalid header
211 }
212
213 fl::string name = http_parser_trim(line.substr(0, colonPos));
214 fl::string value = http_parser_trim(line.substr(colonPos + 1));
215
216 req().headers[name] = value;
217 }
218}
219
220void HttpRequestParser::parseBody() {
221 if (mIsChunked) {

Callers

nothing calls this directly

Calls 6

http_parser_trimFunction · 0.85
has_valueMethod · 0.45
valueMethod · 0.45
dataMethod · 0.45
findMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected