Moved HTTP header Cache-Control and Connection to the top.
This way they are alwas sent, not just on success.
This commit is contained in:
parent
4da9a2144e
commit
f611990708
@ -33,6 +33,9 @@ fs::path global::avatar_dir = "";
|
||||
int main()
|
||||
{
|
||||
cout << "Server: libravatarserv/" << global::version << endl;
|
||||
cout << "Cache-Control: max-age=86400\n";
|
||||
cout << "Connection: close\n";
|
||||
|
||||
const char *request = std::getenv("REQUEST_URI");
|
||||
if (request == nullptr)
|
||||
{
|
||||
@ -54,9 +57,7 @@ int main()
|
||||
image::Image answer = image::get(avatar.digest, avatar.size);
|
||||
if (answer.error == 0)
|
||||
{
|
||||
cout << "Content-type: image/png\n";
|
||||
cout << "Cache-Control: max-age=86400\n";
|
||||
cout << "Connection: close\n\n";
|
||||
cout << "Content-type: image/png\n\n";
|
||||
cout.flush(); // We need to flush before we use /dev/stdout directly.
|
||||
answer.image.write("/dev/stdout");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user