snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit f66080f67ca2bcc0dce040fdffc6718f1b1d4bf3
parent cada652f3ff1f8c3fa114e4af3c3de99114ccbbf
Author: grunfink <grunfink@noreply.codeberg.org>
Date:   Sat, 13 May 2023 07:16:33 +0000

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.

Diffstat:
Mwebfinger.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/webfinger.c b/webfinger.c @@ -46,7 +46,8 @@ int webfinger_request(const char *qs, char **actor, char **user) if (host == NULL || resource == NULL) return 400; - headers = xs_dict_append(headers, "accept", "application/json"); + headers = xs_dict_append(headers, "accept", "application/json"); + headers = xs_dict_append(headers, "user-agent", USER_AGENT); /* is it a query about one of us? */ if (strcmp(host, xs_dict_get(srv_config, "host")) == 0) {