diff options
author | default <nobody@localhost> | 2023-07-02 11:11:01 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2023-07-02 11:11:01 +0200 |
commit | d343b40ee553de8d98c18d3547e6c9b12ab96b48 (patch) | |
tree | 2f2d9ab495d2ad4e8187f31530d8019968b905bf /httpd.c | |
parent | b5495ab40b960864e46d55ad28255664e0f4eb73 (diff) |
Added HTTP caching to static data.
Diffstat (limited to 'httpd.c')
-rw-r--r-- | httpd.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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); |