diff options
| author | 2025-10-18 21:33:31 +0200 | |
|---|---|---|
| committer | 2025-10-18 21:33:31 +0200 | |
| commit | 2d433afc27afe46c9641cd0b0bd076566cfb67e2 (patch) | |
| tree | 826378411a16df79b16b5b351b7c56d20db3219f /xs_httpd.h | |
| parent | FEDERATION.md: also document outgoing Webmention. (diff) | |
| download | snac2-2d433afc27afe46c9641cd0b0bd076566cfb67e2.tar.gz snac2-2d433afc27afe46c9641cd0b0bd076566cfb67e2.tar.xz snac2-2d433afc27afe46c9641cd0b0bd076566cfb67e2.zip | |
Enhances Mastodon API compatibility by adding support for displaying remote users' follower/following/post counts and their posts when viewing profiles in Mastodon-compatible apps (Fedilab, Tusky, etc.).
Fixes for Moshidon and improvements for better compatibility with HAProxy
Diffstat (limited to 'xs_httpd.h')
| -rw-r--r-- | xs_httpd.h | 28 |
1 files changed, 28 insertions, 0 deletions
| @@ -87,6 +87,34 @@ xs_dict *xs_httpd_request(FILE *f, xs_str **payload, int *p_size) | |||
| 87 | *p_size = atoi(v); | 87 | *p_size = atoi(v); |
| 88 | *payload = xs_read(f, p_size); | 88 | *payload = xs_read(f, p_size); |
| 89 | } | 89 | } |
| 90 | else if ((v = xs_dict_get(req, "transfer-encoding")) != NULL && | ||
| 91 | xs_startswith(v, "chunked")) { | ||
| 92 | /* handle chunked transfer encoding */ | ||
| 93 | xs_str *body = xs_str_new(NULL); | ||
| 94 | |||
| 95 | for (;;) { | ||
| 96 | xs *line = xs_strip_i(xs_readline(f)); | ||
| 97 | |||
| 98 | /* parse chunk size (in hex) */ | ||
| 99 | int chunk_size = strtol(line, NULL, 16); | ||
| 100 | |||
| 101 | if (chunk_size <= 0) | ||
| 102 | break; | ||
| 103 | |||
| 104 | /* read chunk data */ | ||
| 105 | xs *chunk = xs_read(f, &chunk_size); | ||
| 106 | if (chunk == NULL) | ||
| 107 | break; | ||
| 108 | |||
| 109 | body = xs_append_m(body, chunk, chunk_size); | ||
| 110 | |||
| 111 | /* read trailing \r\n after chunk data */ | ||
| 112 | xs_readline(f); | ||
| 113 | } | ||
| 114 | |||
| 115 | *p_size = xs_size(body) - 1; /* subtract trailing null */ | ||
| 116 | *payload = body; | ||
| 117 | } | ||
| 90 | 118 | ||
| 91 | v = xs_dict_get(req, "content-type"); | 119 | v = xs_dict_get(req, "content-type"); |
| 92 | 120 | ||