81 {
82 const size_t methodEnd = requestLine.find(' ');
83 if (methodEnd == std::string_view::npos) {
84 return std::nullopt;
85 }
86 const std::string_view method = requestLine.substr(0, methodEnd);
87 requestLine.remove_prefix(methodEnd + 1);
88
89 const size_t pathEnd = requestLine.find(' ');
90 if (pathEnd == std::string_view::npos) {
91 return std::nullopt;
92 }
93 const std::string_view path = requestLine.substr(0, pathEnd);
94 const std::string_view version = requestLine.substr(pathEnd + 1);
95
96 if (method.empty() || path.empty() || version.empty()) {
97 return std::nullopt;
98 }
99
100 return std::make_tuple(method, path, version);
101}