summaryrefslogtreecommitdiff
path: root/xs_httpd.h
diff options
context:
space:
mode:
authorGravatar default2024-03-09 08:32:20 +0100
committerGravatar default2024-03-09 08:32:20 +0100
commit00b019b8902e9d319d855b9156f97f931923331c (patch)
tree3d17736c3884f119b3e223947bea31b6f5953ce1 /xs_httpd.h
parentBackport from xs. (diff)
downloadsnac2-00b019b8902e9d319d855b9156f97f931923331c.tar.gz
snac2-00b019b8902e9d319d855b9156f97f931923331c.tar.xz
snac2-00b019b8902e9d319d855b9156f97f931923331c.zip
Backport from xs.
Diffstat (limited to 'xs_httpd.h')
-rw-r--r--xs_httpd.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/xs_httpd.h b/xs_httpd.h
index b7f614c..4d006d7 100644
--- a/xs_httpd.h
+++ b/xs_httpd.h
@@ -98,15 +98,14 @@ void xs_httpd_response(FILE *f, int status, xs_dict *headers, xs_str *body, int
98/* sends an httpd response */ 98/* sends an httpd response */
99{ 99{
100 xs *proto; 100 xs *proto;
101 xs_dict *p;
102 xs_str *k; 101 xs_str *k;
103 xs_val *v; 102 xs_val *v;
104 103
105 proto = xs_fmt("HTTP/1.1 %d %s", status, status / 100 == 2 ? "OK" : "ERROR"); 104 proto = xs_fmt("HTTP/1.1 %d %s", status, status / 100 == 2 ? "OK" : "ERROR");
106 fprintf(f, "%s\r\n", proto); 105 fprintf(f, "%s\r\n", proto);
107 106
108 p = headers; 107 int c = 0;
109 while (xs_dict_iter(&p, &k, &v)) { 108 while (xs_dict_next(headers, &k, &v, &c)) {
110 fprintf(f, "%s: %s\r\n", k, v); 109 fprintf(f, "%s: %s\r\n", k, v);
111 } 110 }
112 111