summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--snac.h2
-rw-r--r--webfinger.c2
-rw-r--r--xs_fcgi.h4
-rw-r--r--xs_httpd.h12
-rw-r--r--xs_version.h2
5 files changed, 11 insertions, 11 deletions
diff --git a/snac.h b/snac.h
index cc66686..b50f345 100644
--- a/snac.h
+++ b/snac.h
@@ -325,7 +325,7 @@ void httpd(void);
325int webfinger_request_signed(snac *snac, const char *qs, xs_str **actor, xs_str **user); 325int webfinger_request_signed(snac *snac, const char *qs, xs_str **actor, xs_str **user);
326int webfinger_request(const char *qs, xs_str **actor, xs_str **user); 326int webfinger_request(const char *qs, xs_str **actor, xs_str **user);
327int webfinger_request_fake(const char *qs, xs_str **actor, xs_str **user); 327int webfinger_request_fake(const char *qs, xs_str **actor, xs_str **user);
328int webfinger_get_handler(xs_dict *req, const char *q_path, 328int webfinger_get_handler(const xs_dict *req, const char *q_path,
329 xs_val **body, int *b_size, char **ctype); 329 xs_val **body, int *b_size, char **ctype);
330 330
331const char *default_avatar_base64(void); 331const char *default_avatar_base64(void);
diff --git a/webfinger.c b/webfinger.c
index dc0855a..46b7edb 100644
--- a/webfinger.c
+++ b/webfinger.c
@@ -152,7 +152,7 @@ int webfinger_request_fake(const char *qs, xs_str **actor, xs_str **user)
152} 152}
153 153
154 154
155int webfinger_get_handler(xs_dict *req, const char *q_path, 155int webfinger_get_handler(const xs_dict *req, const char *q_path,
156 xs_val **body, int *b_size, char **ctype) 156 xs_val **body, int *b_size, char **ctype)
157/* serves webfinger queries */ 157/* serves webfinger queries */
158{ 158{
diff --git a/xs_fcgi.h b/xs_fcgi.h
index 0b53dac..b3cb892 100644
--- a/xs_fcgi.h
+++ b/xs_fcgi.h
@@ -13,7 +13,7 @@
13#define _XS_FCGI_H 13#define _XS_FCGI_H
14 14
15 xs_dict *xs_fcgi_request(FILE *f, xs_str **payload, int *p_size, int *id); 15 xs_dict *xs_fcgi_request(FILE *f, xs_str **payload, int *p_size, int *id);
16 void xs_fcgi_response(FILE *f, int status, xs_dict *headers, xs_str *body, int b_size, int id); 16 void xs_fcgi_response(FILE *f, int status, const xs_dict *headers, const xs_str *body, int b_size, int id);
17 17
18 18
19#ifdef XS_IMPLEMENTATION 19#ifdef XS_IMPLEMENTATION
@@ -290,7 +290,7 @@ end:
290} 290}
291 291
292 292
293void xs_fcgi_response(FILE *f, int status, xs_dict *headers, xs_str *body, int b_size, int fcgi_id) 293void xs_fcgi_response(FILE *f, int status, const xs_dict *headers, const xs_str *body, int b_size, int fcgi_id)
294/* writes an FCGI response */ 294/* writes an FCGI response */
295{ 295{
296 struct fcgi_record_header hdr = {0}; 296 struct fcgi_record_header hdr = {0};
diff --git a/xs_httpd.h b/xs_httpd.h
index 4cc8263..57759c4 100644
--- a/xs_httpd.h
+++ b/xs_httpd.h
@@ -5,7 +5,8 @@
5#define _XS_HTTPD_H 5#define _XS_HTTPD_H
6 6
7xs_dict *xs_httpd_request(FILE *f, xs_str **payload, int *p_size); 7xs_dict *xs_httpd_request(FILE *f, xs_str **payload, int *p_size);
8void xs_httpd_response(FILE *f, int status, const char *status_text, xs_dict *headers, xs_str *body, int b_size); 8void xs_httpd_response(FILE *f, int status, const char *status_text,
9 const xs_dict *headers, const xs_val *body, int b_size);
9 10
10 11
11#ifdef XS_IMPLEMENTATION 12#ifdef XS_IMPLEMENTATION
@@ -109,16 +110,15 @@ xs_dict *xs_httpd_request(FILE *f, xs_str **payload, int *p_size)
109} 110}
110 111
111 112
112void xs_httpd_response(FILE *f, int status, const char *status_text, xs_dict *headers, xs_str *body, int b_size) 113void xs_httpd_response(FILE *f, int status, const char *status_text,
114 const xs_dict *headers, const xs_val *body, int b_size)
113/* sends an httpd response */ 115/* sends an httpd response */
114{ 116{
115 xs *proto; 117 fprintf(f, "HTTP/1.1 %d %s\r\n", status, status_text ? status_text : "");
118
116 const xs_str *k; 119 const xs_str *k;
117 const xs_val *v; 120 const xs_val *v;
118 121
119 proto = xs_fmt("HTTP/1.1 %d %s", status, status_text);
120 fprintf(f, "%s\r\n", proto);
121
122 xs_dict_foreach(headers, k, v) { 122 xs_dict_foreach(headers, k, v) {
123 fprintf(f, "%s: %s\r\n", k, v); 123 fprintf(f, "%s: %s\r\n", k, v);
124 } 124 }
diff --git a/xs_version.h b/xs_version.h
index 09b1bdc..466535b 100644
--- a/xs_version.h
+++ b/xs_version.h
@@ -1 +1 @@
/* a32c0d513ae24ad28ffc5c6c2c1cde75bb758e09 2025-06-23T17:43:10+02:00 */ /* 401d229ffbec89b4a5cf97793926b7afb84a4f26 2025-07-08T15:44:54+02:00 */