#include "HttpParser.h" #include "StringUtils.h" bool HttpParser::parsePreamble(const std::string& line, HttpPreamble& preamble) { bool inPath{ false }; bool inMethod{ true }; bool inProtocol{ false }; for (const auto c : line) { if (inPath) { if (StringUtils::isSpace(c)) { inPath = false; inMethod = true; } else { preamble.mPath.push_back(c); } } else if (inMethod) { if (StringUtils::isSpace(c)) { inMethod = false; inProtocol = true; } else { preamble.mMethod.push_back(c); } } else if (inProtocol) { preamble.mVersion.push_back(c); } } return true; }