Abort if favicon is requested.

This commit is contained in:
tastytea 2018-11-28 17:29:08 +01:00
parent 75680b3739
commit f670c1c8a1
Signed by untrusted user: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 6 additions and 2 deletions

View File

@ -26,6 +26,11 @@ using namespace http;
const Request http::parse_request(const string &request)
{
if (request.substr(0, 8) == "/favicon")
{
cout << "Status: 404 Not Found\n\n";
std::exit(0);
}
if (request.substr(0, 8) != "/avatar/" ||
request.find("..", 8) != std::string::npos)
{

View File

@ -44,6 +44,7 @@ int main()
cerr << "Error: ${REQUEST_URI} is empty.\n";
return 1;
}
http::Request avatar = http::parse_request(request);
if (!find_avatar_dir())
{
@ -54,8 +55,6 @@ int main()
hash::fill_table();
read_settings();
http::Request avatar = http::parse_request(request);
image::Image image = image::get(avatar.digest, avatar.size);
if (image.error == 0)
{