mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 14:35:04 +00:00
In activitypub_request(), retry failed signed requests as non-signed.
This commit is contained in:
parent
1630519066
commit
1d82d13d62
1 changed files with 13 additions and 3 deletions
|
@ -55,13 +55,23 @@ int activitypub_request(snac *snac, char *url, d_char **data)
|
||||||
int p_size;
|
int p_size;
|
||||||
char *ctype;
|
char *ctype;
|
||||||
|
|
||||||
/* check if it's an url for this same site */
|
|
||||||
/* ... */
|
|
||||||
|
|
||||||
/* get from the net */
|
/* get from the net */
|
||||||
response = http_signed_request(snac, "GET", url,
|
response = http_signed_request(snac, "GET", url,
|
||||||
NULL, NULL, 0, &status, &payload, &p_size, 0);
|
NULL, NULL, 0, &status, &payload, &p_size, 0);
|
||||||
|
|
||||||
|
if (status == 0 || (status >= 500 && status <= 599)) {
|
||||||
|
/* I found an instance running Misskey that returned
|
||||||
|
500 on signed messages but returned the object
|
||||||
|
perfectly without signing (?), so why not try */
|
||||||
|
xs_free(response);
|
||||||
|
|
||||||
|
xs *hdrs = xs_dict_new();
|
||||||
|
hdrs = xs_dict_append(hdrs, "accept", "application/activity+json");
|
||||||
|
|
||||||
|
response = xs_http_request("GET", url, hdrs,
|
||||||
|
NULL, 0, &status, &payload, &p_size, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (valid_status(status)) {
|
if (valid_status(status)) {
|
||||||
/* ensure it's ActivityPub data */
|
/* ensure it's ActivityPub data */
|
||||||
ctype = xs_dict_get(response, "content-type");
|
ctype = xs_dict_get(response, "content-type");
|
||||||
|
|
Loading…
Reference in a new issue