summaryrefslogtreecommitdiff
path: root/webfinger.c
diff options
context:
space:
mode:
authorGravatar iwojim02024-03-09 14:37:54 +0000
committerGravatar iwojim02024-03-09 14:37:54 +0000
commit7312f4ce51100d4ed98988cb3af0ab06e4fba53c (patch)
treeb9fe2c67d8d98605d5376bbad6ffe87ef29c1990 /webfinger.c
parentReplaced all xs_dict_iter() with xs_dict_next(). (diff)
downloadsnac2-7312f4ce51100d4ed98988cb3af0ab06e4fba53c.tar.gz
snac2-7312f4ce51100d4ed98988cb3af0ab06e4fba53c.tar.xz
snac2-7312f4ce51100d4ed98988cb3af0ab06e4fba53c.zip
Ability to federate with hidden networks #93 (update for v2.49)
Diffstat (limited to 'webfinger.c')
-rw-r--r--webfinger.c9
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);