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

Method parseStatusLine

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

Source from the content-addressed store, hash-verified

387}
388
389bool HttpResponseParser::parseStatusLine() {
390 auto crlfPos = findCRLF();
391 if (!crlfPos.has_value()) {
392 return false; // Need more data
393 }
394
395 // Extract status line
396 fl::string line(reinterpret_cast<const char*>(mBuffer.data()), crlfPos.value()); // ok reinterpret cast
397 consume(crlfPos.value() + 2); // +2 for CRLF
398
399 // Parse: "VERSION STATUS_CODE REASON_PHRASE"
400 size_t versionEnd = line.find(' ');
401 if (versionEnd == fl::string::npos) {
402 return false; // Invalid format
403 }
404
405 size_t statusEnd = line.find(' ', versionEnd + 1);
406 if (statusEnd == fl::string::npos) {
407 // No reason phrase (optional in HTTP/1.1)
408 statusEnd = line.size();
409 }
410
411 resp().version = line.substr(0, versionEnd);
412 fl::string statusStr = line.substr(versionEnd + 1, statusEnd - versionEnd - 1);
413
414 if (!parseInt(statusStr, resp().statusCode)) {
415 return false; // Invalid status code
416 }
417
418 if (statusEnd < line.size()) {
419 resp().reasonPhrase = line.substr(statusEnd + 1);
420 }
421
422 return true;
423}
424
425bool HttpResponseParser::parseHeaders() {
426 while (true) {

Callers

nothing calls this directly

Calls 7

parseIntFunction · 0.70
has_valueMethod · 0.45
dataMethod · 0.45
valueMethod · 0.45
findMethod · 0.45
sizeMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected