Added some headers.

Cache-Control: max-age=86400
Connection: close
Server: libravatarserv/version
This commit is contained in:
tastytea 2018-11-26 02:36:20 +01:00
parent a2254a9ae5
commit ee2a118c1f
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.2) cmake_minimum_required (VERSION 3.2)
project(libravatarserv project(libravatarserv
VERSION 0.2.5 VERSION 0.3.0
LANGUAGES CXX LANGUAGES CXX
) )

View File

@ -18,6 +18,7 @@
#include <algorithm> #include <algorithm>
#include <cstdlib> #include <cstdlib>
#include <basedir.h> #include <basedir.h>
#include "version.hpp"
#include "libravatarserv.hpp" #include "libravatarserv.hpp"
using std::cout; using std::cout;
@ -79,7 +80,10 @@ int main()
image::Image answer = image::get(digest, size); image::Image answer = image::get(digest, size);
if (answer.error == 0) if (answer.error == 0)
{ {
cout << "Content-type: image/png\n\n"; cout << "Content-type: image/png\n";
cout << "Cache-Control: max-age=86400\n";
cout << "Connection: close\n";
cout << "Server: libravatarserv/" << global::version << endl << endl;
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("test.png"); // answer.image.write("test.png");
answer.image.write("/dev/stdout"); answer.image.write("/dev/stdout");