Use url parsing

This commit is contained in:
2019-06-15 20:52:40 +02:00
parent 22d5430e57
commit 71a7aa147c
10 changed files with 126 additions and 71 deletions

View File

@@ -27,8 +27,17 @@ namespace Http
std::string requestTypeString;
ss >> requestTypeString;
request.requestType = ToEnum<HttpRequest::Type>(requestTypeString, HttpRequest::typeStrings);
if (request.requestType == HttpRequest::Type::UNKNOWN)
{
throw std::runtime_error("Bad request type");
}
ss >> request.path;
std::string rawUrl;
ss >> rawUrl;
if(!request.url.TryParseFromUrlString(rawUrl))
{
throw std::runtime_error("Bad url in request");
}
std::string httpProtocolString;
ss >> httpProtocolString;