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

Method parseRequestLine

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

Source from the content-addressed store, hash-verified

159}
160
161bool HttpRequestParser::parseRequestLine() {
162 auto crlfPos = findCRLF();
163 if (!crlfPos.has_value()) {
164 return false; // Need more data
165 }
166
167 // Extract request line
168 fl::string line(reinterpret_cast<const char*>(mBuffer.data()), crlfPos.value()); // ok reinterpret cast
169
170 consume(crlfPos.value() + 2); // +2 for CRLF
171
172 // Parse: "METHOD URI VERSION"
173 size_t methodEnd = line.find(' ');
174 if (methodEnd == fl::string::npos) {
175 return false; // Invalid format
176 }
177
178 size_t uriEnd = line.find(' ', methodEnd + 1);
179 if (uriEnd == fl::string::npos) {
180 return false; // Invalid format
181 }
182
183 req().method = line.substr(0, methodEnd);
184 req().uri = line.substr(methodEnd + 1, uriEnd - methodEnd - 1);
185 req().version = line.substr(uriEnd + 1);
186
187 return true;
188}
189
190bool HttpRequestParser::parseHeaders() {
191 while (true) {

Callers

nothing calls this directly

Calls 5

has_valueMethod · 0.45
dataMethod · 0.45
valueMethod · 0.45
findMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected