aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2014-10-29 13:34:19 +0100
committerGravatar Christian Hesse <mail@eworm.de>2014-10-29 13:34:19 +0100
commitdd0d07ebf2b960f87bc4775aa61d051682fa6f94 (patch)
tree9c958d69c62f988187cc1c127758b4b3ce2b6897
parent868248b043aa569e7e429a7831e3f5d6a4935e7a (diff)
downloadcqrlogo-dd0d07ebf2b960f87bc4775aa61d051682fa6f94.tar.gz
cqrlogo-dd0d07ebf2b960f87bc4775aa61d051682fa6f94.tar.zst
add some more HTTP headers
-rw-r--r--cqrlogo.c4
-rw-r--r--cqrlogo.h1
-rw-r--r--lib/libcqrlogo.h1
3 files changed, 6 insertions, 0 deletions
diff --git a/cqrlogo.c b/cqrlogo.c
index 80b57e0..ba4481e 100644
--- a/cqrlogo.c
+++ b/cqrlogo.c
@@ -17,6 +17,7 @@ int main(int argc, char **argv) {
regex_t preg;
regmatch_t pmatch[1];
uint8_t https;
+ struct timeval tv;
struct cqr_png * png;
struct cqr_bitmap * bitmap;
@@ -104,7 +105,10 @@ int main(int argc, char **argv) {
/* print HTTP header */
fputs(CQR_HEADER_CONTENT_TYPE, stdout);
fputs(CQR_HEADER_CONTENT_DISPOSITION, stdout);
+ fputs(CQR_HEADER_CACHE_CONTROL, stdout);
fputs(CQR_HEADER_PRAGMA, stdout);
+ gettimeofday(&tv, NULL);
+ fprintf(stdout, "ETag: %lu%lu\n", tv.tv_sec, tv.tv_usec);
fputc('\n', stdout);
/* write PNG data to stdout */
diff --git a/cqrlogo.h b/cqrlogo.h
index 430df26..cf5db51 100644
--- a/cqrlogo.h
+++ b/cqrlogo.h
@@ -16,6 +16,7 @@
#include <inttypes.h>
#include <regex.h>
#include <stdbool.h>
+#include <sys/time.h>
#if HAVE_FCGI
#include <fcgi_stdio.h>
diff --git a/lib/libcqrlogo.h b/lib/libcqrlogo.h
index eb945b1..73ce149 100644
--- a/lib/libcqrlogo.h
+++ b/lib/libcqrlogo.h
@@ -42,6 +42,7 @@ struct cqr_conf {
bool overwrite;
};
+#define CQR_HEADER_CACHE_CONTROL "Cache-Control: no-cache\nCache-Control: max-age=0\n"
#define CQR_HEADER_CONTENT_TYPE "Content-Type: image/png\n"
#define CQR_HEADER_CONTENT_DISPOSITION "Content-Disposition: inline; filename=\"cqrlogo.png\"\n"
#define CQR_HEADER_PRAGMA "Pragma: no-cache\n"