diff options
| author | 2025-07-08 17:30:45 +0200 | |
|---|---|---|
| committer | 2025-07-08 17:30:45 +0200 | |
| commit | 08f03cde6b469428494d3870ac54f740fd4641c4 (patch) | |
| tree | b537c9c4b26e60eff3f563efb1f950edcf791ce9 | |
| parent | Minor webfinger tweak. (diff) | |
| download | snac2-08f03cde6b469428494d3870ac54f740fd4641c4.tar.gz snac2-08f03cde6b469428494d3870ac54f740fd4641c4.tar.xz snac2-08f03cde6b469428494d3870ac54f740fd4641c4.zip | |
Added some const here and there.
| -rw-r--r-- | snac.h | 2 | ||||
| -rw-r--r-- | webfinger.c | 2 | ||||
| -rw-r--r-- | xs_fcgi.h | 4 | ||||
| -rw-r--r-- | xs_httpd.h | 12 | ||||
| -rw-r--r-- | xs_version.h | 2 |
5 files changed, 11 insertions, 11 deletions
| @@ -325,7 +325,7 @@ void httpd(void); | |||
| 325 | int webfinger_request_signed(snac *snac, const char *qs, xs_str **actor, xs_str **user); | 325 | int webfinger_request_signed(snac *snac, const char *qs, xs_str **actor, xs_str **user); |
| 326 | int webfinger_request(const char *qs, xs_str **actor, xs_str **user); | 326 | int webfinger_request(const char *qs, xs_str **actor, xs_str **user); |
| 327 | int webfinger_request_fake(const char *qs, xs_str **actor, xs_str **user); | 327 | int webfinger_request_fake(const char *qs, xs_str **actor, xs_str **user); |
| 328 | int webfinger_get_handler(xs_dict *req, const char *q_path, | 328 | int 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 | ||
| 331 | const char *default_avatar_base64(void); | 331 | const 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 | ||
| 155 | int webfinger_get_handler(xs_dict *req, const char *q_path, | 155 | int 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 | { |
| @@ -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 | ||
| 293 | void xs_fcgi_response(FILE *f, int status, xs_dict *headers, xs_str *body, int b_size, int fcgi_id) | 293 | void 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}; |
| @@ -5,7 +5,8 @@ | |||
| 5 | #define _XS_HTTPD_H | 5 | #define _XS_HTTPD_H |
| 6 | 6 | ||
| 7 | xs_dict *xs_httpd_request(FILE *f, xs_str **payload, int *p_size); | 7 | xs_dict *xs_httpd_request(FILE *f, xs_str **payload, int *p_size); |
| 8 | void xs_httpd_response(FILE *f, int status, const char *status_text, xs_dict *headers, xs_str *body, int b_size); | 8 | void 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 | ||
| 112 | void xs_httpd_response(FILE *f, int status, const char *status_text, xs_dict *headers, xs_str *body, int b_size) | 113 | void 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 */ | ||