Use url parsing
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user