MCPcopy Create free account
hub / github.com/Selectively11/CloudRedirect / ParseRequestLine

Function ParseRequestLine

src/platform/linux/http_server.cpp:252–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252static bool ParseRequestLine(const char* buf, size_t len, std::string& method, std::string& path) {
253 std::string line(buf, std::min(len, (size_t)4096));
254 auto endOfLine = line.find("\r\n");
255 if (endOfLine != std::string::npos) line = line.substr(0, endOfLine);
256
257 auto sp1 = line.find(' ');
258 if (sp1 == std::string::npos) return false;
259 method = line.substr(0, sp1);
260
261 auto sp2 = line.find(' ', sp1 + 1);
262 if (sp2 == std::string::npos) return false;
263 path = line.substr(sp1 + 1, sp2 - sp1 - 1);
264
265 return true;
266}
267
268static void HandleConnection(int clientFd) {
269 char buf[8192];

Callers 1

HandleConnectionFunction · 0.85

Calls 1

findMethod · 0.80

Tested by

no test coverage detected