summaryrefslogtreecommitdiff
path: root/httpd.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-08-19 12:52:28 +0200
committerdefault <nobody@localhost>2023-08-19 12:52:28 +0200
commit26f2c40579d7b28f0c59f16f521008235d02a9be (patch)
tree4d49977ac607c61648903d5334928edd1cabd932 /httpd.c
parent1f9c18c3bdaa177fc027b2503a067984e8a50c67 (diff)
The hash 'more_headers' is added to the response HTTP headers.
Diffstat (limited to 'httpd.c')
-rw-r--r--httpd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/httpd.c b/httpd.c
index cdead11..5f24685 100644
--- a/httpd.c
+++ b/httpd.c
@@ -285,6 +285,14 @@ void httpd_connection(FILE *f)
if (!xs_is_null(etag))
headers = xs_dict_append(headers, "etag", etag);
+ /* if there are any additional headers, add them */
+ xs_dict *more_headers = xs_dict_get(srv_config, "http_headers");
+ if (xs_type(more_headers) == XSTYPE_DICT) {
+ char *k, *v;
+ while (xs_dict_iter(&more_headers, &k, &v))
+ headers = xs_dict_set(headers, k, v);
+ }
+
if (b_size == 0 && body != NULL)
b_size = strlen(body);