summaryrefslogtreecommitdiff
path: root/xs_httpd.h
diff options
context:
space:
mode:
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)
16 xs *q_vars = NULL; 16 xs *q_vars = NULL;
17 xs *p_vars = NULL; 17 xs *p_vars = NULL;
18 xs *l1, *l2; 18 xs *l1, *l2;
19 char *v; 19 const char *v;
20 20
21 xs_socket_timeout(fileno(f), 2.0, 0.0); 21 xs_socket_timeout(fileno(f), 2.0, 0.0);
22 22
@@ -60,7 +60,8 @@ xs_dict *xs_httpd_request(FILE *f, xs_str **payload, int *p_size)
60 p = xs_split_n(l, ": ", 1); 60 p = xs_split_n(l, ": ", 1);
61 61
62 if (xs_list_len(p) == 2) 62 if (xs_list_len(p) == 2)
63 req = xs_dict_append(req, xs_tolower_i(xs_list_get(p, 0)), xs_list_get(p, 1)); 63 req = xs_dict_append(req, xs_tolower_i(
64 (xs_str *)xs_list_get(p, 0)), xs_list_get(p, 1));
64 } 65 }
65 66
66 xs_socket_timeout(fileno(f), 5.0, 0.0); 67 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
98/* sends an httpd response */ 99/* sends an httpd response */
99{ 100{
100 xs *proto; 101 xs *proto;
101 xs_str *k; 102 const xs_str *k;
102 xs_val *v; 103 const xs_val *v;
103 104
104 proto = xs_fmt("HTTP/1.1 %d %s", status, status / 100 == 2 ? "OK" : "ERROR"); 105 proto = xs_fmt("HTTP/1.1 %d %s", status, status / 100 == 2 ? "OK" : "ERROR");
105 fprintf(f, "%s\r\n", proto); 106 fprintf(f, "%s\r\n", proto);