summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar grunfink2023-05-13 07:16:33 +0000
committerGravatar grunfink2023-05-13 07:16:33 +0000
commitf66080f67ca2bcc0dce040fdffc6718f1b1d4bf3 (patch)
treed07fc22d0546af0a16ec94b9b66abc491e10b749
parentMerge branch 'master' of triptico.com:git/snac2 (diff)
parentAdded user-agent to webfinger query (diff)
downloadpenes-snac2-f66080f67ca2bcc0dce040fdffc6718f1b1d4bf3.tar.gz
penes-snac2-f66080f67ca2bcc0dce040fdffc6718f1b1d4bf3.tar.xz
penes-snac2-f66080f67ca2bcc0dce040fdffc6718f1b1d4bf3.zip
Merge pull request 'Added user-agent to webfinger query' (#34) from poesty/snac2:master into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/34 This is to avoid that when sending webfinger queries to some instances (e.g. GoToSocial), we cannot fetch their resources because of the 418 status code returned by the other side.
-rw-r--r--webfinger.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/webfinger.c b/webfinger.c
index c7b73f7..19036fb 100644
--- a/webfinger.c
+++ b/webfinger.c
@@ -46,7 +46,8 @@ int webfinger_request(const char *qs, char **actor, char **user)
46 if (host == NULL || resource == NULL) 46 if (host == NULL || resource == NULL)
47 return 400; 47 return 400;
48 48
49 headers = xs_dict_append(headers, "accept", "application/json"); 49 headers = xs_dict_append(headers, "accept", "application/json");
50 headers = xs_dict_append(headers, "user-agent", USER_AGENT);
50 51
51 /* is it a query about one of us? */ 52 /* is it a query about one of us? */
52 if (strcmp(host, xs_dict_get(srv_config, "host")) == 0) { 53 if (strcmp(host, xs_dict_get(srv_config, "host")) == 0) {