forked from tastytea/libravatarserv
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()
|
int main()
|
||||||
{
|
{
|
||||||
cout << "Server: libravatarserv/" << global::version << endl;
|
cout << "Server: libravatarserv/" << global::version << endl;
|
||||||
|
cout << "Cache-Control: max-age=86400\n";
|
||||||
|
cout << "Connection: close\n";
|
||||||
|
|
||||||
const char *request = std::getenv("REQUEST_URI");
|
const char *request = std::getenv("REQUEST_URI");
|
||||||
if (request == nullptr)
|
if (request == nullptr)
|
||||||
{
|
{
|
||||||
|
@ -54,9 +57,7 @@ int main()
|
||||||
image::Image answer = image::get(avatar.digest, avatar.size);
|
image::Image answer = image::get(avatar.digest, avatar.size);
|
||||||
if (answer.error == 0)
|
if (answer.error == 0)
|
||||||
{
|
{
|
||||||
cout << "Content-type: image/png\n";
|
cout << "Content-type: image/png\n\n";
|
||||||
cout << "Cache-Control: max-age=86400\n";
|
|
||||||
cout << "Connection: close\n\n";
|
|
||||||
cout.flush(); // We need to flush before we use /dev/stdout directly.
|
cout.flush(); // We need to flush before we use /dev/stdout directly.
|
||||||
answer.image.write("/dev/stdout");
|
answer.image.write("/dev/stdout");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue