commit 26f2c40

default  ·  2023-08-19 10:52:28 +0000 UTC
parent 1f9c18c
The hash 'more_headers' is added to the response HTTP headers.
1 files changed,  +8, -0
+8, -0
 1@@ -285,6 +285,14 @@ void httpd_connection(FILE *f)
 2     if (!xs_is_null(etag))
 3         headers = xs_dict_append(headers, "etag", etag);
 4 
 5+    /* if there are any additional headers, add them */
 6+    xs_dict *more_headers = xs_dict_get(srv_config, "http_headers");
 7+    if (xs_type(more_headers) == XSTYPE_DICT) {
 8+        char *k, *v;
 9+        while (xs_dict_iter(&more_headers, &k, &v))
10+            headers = xs_dict_set(headers, k, v);
11+    }
12+
13     if (b_size == 0 && body != NULL)
14         b_size = strlen(body);
15