diff options
| -rw-r--r-- | activitypub.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/activitypub.c b/activitypub.c index c05c859..cef5c02 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -55,13 +55,23 @@ int activitypub_request(snac *snac, char *url, d_char **data) | |||
| 55 | int p_size; | 55 | int p_size; |
| 56 | char *ctype; | 56 | char *ctype; |
| 57 | 57 | ||
| 58 | /* check if it's an url for this same site */ | ||
| 59 | /* ... */ | ||
| 60 | |||
| 61 | /* get from the net */ | 58 | /* get from the net */ |
| 62 | response = http_signed_request(snac, "GET", url, | 59 | response = http_signed_request(snac, "GET", url, |
| 63 | NULL, NULL, 0, &status, &payload, &p_size, 0); | 60 | NULL, NULL, 0, &status, &payload, &p_size, 0); |
| 64 | 61 | ||
| 62 | if (status == 0 || (status >= 500 && status <= 599)) { | ||
| 63 | /* I found an instance running Misskey that returned | ||
| 64 | 500 on signed messages but returned the object | ||
| 65 | perfectly without signing (?), so why not try */ | ||
| 66 | xs_free(response); | ||
| 67 | |||
| 68 | xs *hdrs = xs_dict_new(); | ||
| 69 | hdrs = xs_dict_append(hdrs, "accept", "application/activity+json"); | ||
| 70 | |||
| 71 | response = xs_http_request("GET", url, hdrs, | ||
| 72 | NULL, 0, &status, &payload, &p_size, 0); | ||
| 73 | } | ||
| 74 | |||
| 65 | if (valid_status(status)) { | 75 | if (valid_status(status)) { |
| 66 | /* ensure it's ActivityPub data */ | 76 | /* ensure it's ActivityPub data */ |
| 67 | ctype = xs_dict_get(response, "content-type"); | 77 | ctype = xs_dict_get(response, "content-type"); |