From d343b40ee553de8d98c18d3547e6c9b12ab96b48 Mon Sep 17 00:00:00 2001 From: default Date: Sun, 2 Jul 2023 11:11:01 +0200 Subject: Added HTTP caching to static data. --- httpd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'httpd.c') diff --git a/httpd.c b/httpd.c index de70089..9aac3b5 100644 --- a/httpd.c +++ b/httpd.c @@ -156,6 +156,7 @@ void httpd_connection(FILE *f) xs *headers = NULL; xs *q_path = NULL; xs *payload = NULL; + xs *etag = NULL; int p_size = 0; char *p; @@ -198,7 +199,7 @@ void httpd_connection(FILE *f) #endif /* NO_MASTODON_API */ if (status == 0) - status = html_get_handler(req, q_path, &body, &b_size, &ctype); + status = html_get_handler(req, q_path, &body, &b_size, &ctype, &etag); } else if (strcmp(method, "POST") == 0) { @@ -263,6 +264,9 @@ void httpd_connection(FILE *f) headers = xs_dict_append(headers, "content-type", ctype); headers = xs_dict_append(headers, "x-creator", USER_AGENT); + if (!xs_is_null(etag)) + headers = xs_dict_append(headers, "etag", etag); + if (b_size == 0 && body != NULL) b_size = strlen(body); -- cgit v1.2.3