diff options
| author | 2024-04-18 15:12:47 +0000 | |
|---|---|---|
| committer | 2024-04-18 15:12:47 +0000 | |
| commit | 100c9cf569ef4497160ac60a55f5b94b9cb524bc (patch) | |
| tree | 30791ca1d83e2b94787e42432898ac7b2c7f7943 /webfinger.c | |
| parent | Improved non-public reply check. (diff) | |
| parent | Ability to federate with hidden networks #93 (update for v2.49) (diff) | |
| download | penes-snac2-100c9cf569ef4497160ac60a55f5b94b9cb524bc.tar.gz penes-snac2-100c9cf569ef4497160ac60a55f5b94b9cb524bc.tar.xz penes-snac2-100c9cf569ef4497160ac60a55f5b94b9cb524bc.zip | |
Merge pull request 'Ability to federate with hidden networks #93 (update for v2.49)' (#149) from iwojima/snac2:master into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/149
Diffstat (limited to 'webfinger.c')
| -rw-r--r-- | webfinger.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/webfinger.c b/webfinger.c index a883d7f..331191b 100644 --- a/webfinger.c +++ b/webfinger.c | |||
| @@ -19,9 +19,10 @@ int webfinger_request_signed(snac *snac, const char *qs, char **actor, char **us | |||
| 19 | xs_str *host = NULL; | 19 | xs_str *host = NULL; |
| 20 | xs *resource = NULL; | 20 | xs *resource = NULL; |
| 21 | 21 | ||
| 22 | if (xs_startswith(qs, "https:/" "/")) { | 22 | if (xs_startswith(qs, "http")) { |
| 23 | /* actor query: pick the host */ | 23 | /* actor query: pick the host */ |
| 24 | xs *s = xs_replace_n(qs, "https:/" "/", "", 1); | 24 | xs *s1 = xs_replace_n(qs, "http:/" "/", "", 1); |
| 25 | xs *s = xs_replace_n(s1, "https:/" "/", "", 1); | ||
| 25 | 26 | ||
| 26 | l = xs_split_n(s, "/", 1); | 27 | l = xs_split_n(s, "/", 1); |
| 27 | 28 | ||
| @@ -69,7 +70,7 @@ int webfinger_request_signed(snac *snac, const char *qs, char **actor, char **us | |||
| 69 | &payload, &p_size, &ctype); | 70 | &payload, &p_size, &ctype); |
| 70 | } | 71 | } |
| 71 | else { | 72 | else { |
| 72 | xs *url = xs_fmt("https:/" "/%s/.well-known/webfinger?resource=%s", host, resource); | 73 | xs *url = xs_fmt("http:/" "/%s/.well-known/webfinger?resource=%s", host, resource); |
| 73 | 74 | ||
| 74 | if (snac == NULL) | 75 | if (snac == NULL) |
| 75 | xs_http_request("GET", url, headers, NULL, 0, &status, &payload, &p_size, 0); | 76 | xs_http_request("GET", url, headers, NULL, 0, &status, &payload, &p_size, 0); |
| @@ -139,7 +140,7 @@ int webfinger_get_handler(xs_dict *req, char *q_path, | |||
| 139 | snac snac; | 140 | snac snac; |
| 140 | int found = 0; | 141 | int found = 0; |
| 141 | 142 | ||
| 142 | if (xs_startswith(resource, "https:/" "/")) { | 143 | if (xs_startswith(resource, "https")) { |
| 143 | /* actor search: find a user with this actor */ | 144 | /* actor search: find a user with this actor */ |
| 144 | xs *l = xs_split(resource, "/"); | 145 | xs *l = xs_split(resource, "/"); |
| 145 | char *uid = xs_list_get(l, -1); | 146 | char *uid = xs_list_get(l, -1); |