Exit with error code 1 if request is bad

This commit is contained in:
tastytea 2018-11-30 06:54:56 +01:00
parent 1aca78df88
commit 06a1bfccd9
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 2 additions and 2 deletions

View File

@ -29,14 +29,14 @@ const Request http::parse_request(const string &request)
if (request.substr(0, 8) == "/favicon")
{
cout << "Status: 404 Not Found\n\n";
std::exit(0);
std::exit(1);
}
if (request.substr(0, 8) != "/avatar/" ||
request.find("..", 8) != std::string::npos)
{
cout << "Status: 400 Bad Request\n\n";
cerr << "Error: Invalid URL.\n";
std::exit(0);
std::exit(1);
}
uint16_t size = 80;