summaryrefslogtreecommitdiff
path: root/xs_httpd.h
diff options
context:
space:
mode:
authorLouis Brauer <louis77@noreply.codeberg.org>2024-05-25 08:05:36 +0000
committerLouis Brauer <louis77@noreply.codeberg.org>2024-05-25 08:05:36 +0000
commit84a767dd0878013194ed7551b5ae6ef715e841a6 (patch)
tree9fb1b2b89e0bfbb4b8bf1e85d840c8653e646bb7 /xs_httpd.h
parentcf5718bf4dedb85d2e1a1495f05bfc7e66124022 (diff)
parenta2920800007c291bdf2b5264622cbc713d4961ee (diff)
Merge pull request 'master' (#1) from grunfink/snac2:master into master
Reviewed-on: https://codeberg.org/louis77/snac2/pulls/1
Diffstat (limited to 'xs_httpd.h')
-rw-r--r--xs_httpd.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/xs_httpd.h b/xs_httpd.h
index 4d006d7..4195b81 100644
--- a/xs_httpd.h
+++ b/xs_httpd.h
@@ -16,7 +16,7 @@ xs_dict *xs_httpd_request(FILE *f, xs_str **payload, int *p_size)
xs *q_vars = NULL;
xs *p_vars = NULL;
xs *l1, *l2;
- char *v;
+ const char *v;
xs_socket_timeout(fileno(f), 2.0, 0.0);
@@ -60,7 +60,8 @@ xs_dict *xs_httpd_request(FILE *f, xs_str **payload, int *p_size)
p = xs_split_n(l, ": ", 1);
if (xs_list_len(p) == 2)
- req = xs_dict_append(req, xs_tolower_i(xs_list_get(p, 0)), xs_list_get(p, 1));
+ req = xs_dict_append(req, xs_tolower_i(
+ (xs_str *)xs_list_get(p, 0)), xs_list_get(p, 1));
}
xs_socket_timeout(fileno(f), 5.0, 0.0);
@@ -98,8 +99,8 @@ void xs_httpd_response(FILE *f, int status, xs_dict *headers, xs_str *body, int
/* sends an httpd response */
{
xs *proto;
- xs_str *k;
- xs_val *v;
+ const xs_str *k;
+ const xs_val *v;
proto = xs_fmt("HTTP/1.1 %d %s", status, status / 100 == 2 ? "OK" : "ERROR");
fprintf(f, "%s\r\n", proto);