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 /html.c | |
parent | b5495ab40b960864e46d55ad28255664e0f4eb73 (diff) |
Added HTTP caching to static data.
Diffstat (limited to 'html.c')
-rw-r--r-- | html.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -226,7 +226,7 @@ d_char *html_user_header(snac *snac, d_char *s, int local) int size; /* try to open the user css */ - if (!valid_status(static_get(snac, "style.css", &css, &size))) { + if (!valid_status(static_get(snac, "style.css", &css, &size, NULL, NULL))) { /* it's not there; try to open the server-wide css */ FILE *f; xs *g_css_fn = xs_fmt("%s/style.css", srv_basedir); @@ -1542,7 +1542,7 @@ xs_str *html_notifications(snac *snac) int html_get_handler(const xs_dict *req, const char *q_path, - char **body, int *b_size, char **ctype) + char **body, int *b_size, char **ctype, xs_str **etag) { char *accept = xs_dict_get(req, "accept"); int status = 404; @@ -1695,10 +1695,12 @@ int html_get_handler(const xs_dict *req, const char *q_path, char *id = xs_list_get(l, 1); int sz; - if (valid_status(static_get(&snac, id, body, &sz))) { + status = static_get(&snac, id, body, &sz, + xs_dict_get(req, "if-none-match"), etag); + + if (valid_status(status)) { *b_size = sz; *ctype = xs_mime_by_ext(id); - status = 200; } } else |