forked from tastytea/libravatarserv
Abort if favicon is requested.
This commit is contained in:
parent
75680b3739
commit
f670c1c8a1
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user