From 280c39bc4d1aa948136e7c3631326e71b2dd1871 Mon Sep 17 00:00:00 2001 From: cflip Date: Thu, 7 Jul 2022 13:47:27 -0600 Subject: Implement simple URI parsing for multiple pages --- src/HttpRequest.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/HttpRequest.cpp') diff --git a/src/HttpRequest.cpp b/src/HttpRequest.cpp index 351c971..27a5ce5 100644 --- a/src/HttpRequest.cpp +++ b/src/HttpRequest.cpp @@ -10,6 +10,11 @@ HttpRequest::HttpRequest(const std::string& request_string) while ((pos = s.find("\r\n")) != std::string::npos) { line = s.substr(0, pos); + if (line.find("GET ") != std::string::npos) { + m_uri = s.substr(4, line.find(" ", 5) - 4); + std::cout << m_uri << std::endl; + } + // If the line contains a colon, we assume it's a header. // TODO: This may not always be the case. size_t delim_pos = 0; -- cgit v1.2.3