summaryrefslogtreecommitdiff
path: root/httpd.c
diff options
context:
space:
mode:
authorGravatar default2024-11-07 19:42:02 +0100
committerGravatar default2024-11-07 19:42:02 +0100
commit0f8ade8c6050d61d1a9bf0522ac087eaf41eab14 (patch)
tree9eff0dbadcf4ca0807fe69f5a1f1ed8cdd20d3f9 /httpd.c
parentAlso use the proxy in replace_shortnames(). (diff)
downloadpenes-snac2-0f8ade8c6050d61d1a9bf0522ac087eaf41eab14.tar.gz
penes-snac2-0f8ade8c6050d61d1a9bf0522ac087eaf41eab14.tar.xz
penes-snac2-0f8ade8c6050d61d1a9bf0522ac087eaf41eab14.zip
Propagate 'last-modified' and 'etag' fields while proxying.
But does it work?
Diffstat (limited to 'httpd.c')
-rw-r--r--httpd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/httpd.c b/httpd.c
index 2fe9d6b..1613e1f 100644
--- a/httpd.c
+++ b/httpd.c
@@ -278,6 +278,7 @@ void httpd_connection(FILE *f)
278 xs *q_path = NULL; 278 xs *q_path = NULL;
279 xs *payload = NULL; 279 xs *payload = NULL;
280 xs *etag = NULL; 280 xs *etag = NULL;
281 xs *last_modified = NULL;
281 int p_size = 0; 282 int p_size = 0;
282 const char *p; 283 const char *p;
283 int fcgi_id; 284 int fcgi_id;
@@ -329,7 +330,7 @@ void httpd_connection(FILE *f)
329#endif /* NO_MASTODON_API */ 330#endif /* NO_MASTODON_API */
330 331
331 if (status == 0) 332 if (status == 0)
332 status = html_get_handler(req, q_path, &body, &b_size, &ctype, &etag); 333 status = html_get_handler(req, q_path, &body, &b_size, &ctype, &etag, &last_modified);
333 } 334 }
334 else 335 else
335 if (strcmp(method, "POST") == 0) { 336 if (strcmp(method, "POST") == 0) {
@@ -423,6 +424,8 @@ void httpd_connection(FILE *f)
423 424
424 if (!xs_is_null(etag)) 425 if (!xs_is_null(etag))
425 headers = xs_dict_append(headers, "etag", etag); 426 headers = xs_dict_append(headers, "etag", etag);
427 if (!xs_is_null(last_modified))
428 headers = xs_dict_append(headers, "last-modified", last_modified);
426 429
427 /* if there are any additional headers, add them */ 430 /* if there are any additional headers, add them */
428 const xs_dict *more_headers = xs_dict_get(srv_config, "http_headers"); 431 const xs_dict *more_headers = xs_dict_get(srv_config, "http_headers");