diff options
| author | 2023-05-07 07:27:24 +0000 | |
|---|---|---|
| committer | 2023-05-07 07:27:24 +0000 | |
| commit | e65760a349112abce39404ca50f6bc2f1301bed9 (patch) | |
| tree | c2484af8006961d95dcf39cf16c3749100a713c9 /webfinger.c | |
| parent | Fixed webfinger and curl issues (diff) | |
| parent | Version 2.30 RELEASED. (diff) | |
| download | snac2-e65760a349112abce39404ca50f6bc2f1301bed9.tar.gz snac2-e65760a349112abce39404ca50f6bc2f1301bed9.tar.xz snac2-e65760a349112abce39404ca50f6bc2f1301bed9.zip | |
Merge pull request 'master' (#1) from grunfink/snac2:master into master
Reviewed-on: https://codeberg.org/poesty/snac2/pulls/1
Diffstat (limited to 'webfinger.c')
| -rw-r--r-- | webfinger.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/webfinger.c b/webfinger.c index 2f11516..c7b73f7 100644 --- a/webfinger.c +++ b/webfinger.c | |||
| @@ -21,7 +21,7 @@ int webfinger_request(const char *qs, char **actor, char **user) | |||
| 21 | 21 | ||
| 22 | if (xs_startswith(qs, "https:/" "/")) { | 22 | if (xs_startswith(qs, "https:/" "/")) { |
| 23 | /* actor query: pick the host */ | 23 | /* actor query: pick the host */ |
| 24 | xs *s = xs_replace(qs, "https:/" "/", ""); | 24 | xs *s = xs_replace_n(qs, "https:/" "/", "", 1); |
| 25 | 25 | ||
| 26 | l = xs_split_n(s, "/", 1); | 26 | l = xs_split_n(s, "/", 1); |
| 27 | 27 | ||
| @@ -74,7 +74,7 @@ int webfinger_request(const char *qs, char **actor, char **user) | |||
| 74 | char *subject = xs_dict_get(obj, "subject"); | 74 | char *subject = xs_dict_get(obj, "subject"); |
| 75 | 75 | ||
| 76 | if (subject) | 76 | if (subject) |
| 77 | *user = xs_replace(subject, "acct:", ""); | 77 | *user = xs_replace_n(subject, "acct:", "", 1); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | if (actor != NULL) { | 80 | if (actor != NULL) { |
| @@ -105,6 +105,8 @@ int webfinger_get_handler(d_char *req, char *q_path, | |||
| 105 | { | 105 | { |
| 106 | int status; | 106 | int status; |
| 107 | 107 | ||
| 108 | (void)b_size; | ||
| 109 | |||
| 108 | if (strcmp(q_path, "/.well-known/webfinger") != 0) | 110 | if (strcmp(q_path, "/.well-known/webfinger") != 0) |
| 109 | return 0; | 111 | return 0; |
| 110 | 112 | ||
| @@ -137,7 +139,7 @@ int webfinger_get_handler(d_char *req, char *q_path, | |||
| 137 | else | 139 | else |
| 138 | if (xs_startswith(resource, "acct:")) { | 140 | if (xs_startswith(resource, "acct:")) { |
| 139 | /* it's an account name */ | 141 | /* it's an account name */ |
| 140 | xs *an = xs_replace(resource, "acct:", ""); | 142 | xs *an = xs_replace_n(resource, "acct:", "", 1); |
| 141 | xs *l = NULL; | 143 | xs *l = NULL; |
| 142 | 144 | ||
| 143 | /* strip a possible leading @ */ | 145 | /* strip a possible leading @ */ |