mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-25 11:01:12 +00:00
sign all AP requests
We have been attempting unsigned GET requests and then if they fail, sending another signed request within the same loop. This not only causes single-threaded instances to fail, confusing new users, but is also unnecessary, since servers that don't require requests to be signed will just ignore the signed headers. Signing all AP requests simplifies things and should see a marginal increase in speed when interacting with new servers that require signed payloads.
This commit is contained in:
parent
cbdb59d3cf
commit
9c89e0fbaf
1 changed files with 3 additions and 7 deletions
|
@ -369,15 +369,11 @@ def resolve_remote_id(
|
||||||
|
|
||||||
# load the data and create the object
|
# load the data and create the object
|
||||||
try:
|
try:
|
||||||
data = get_data(remote_id)
|
data = get_activitypub_data(remote_id)
|
||||||
except ConnectionError:
|
except ConnectionError:
|
||||||
logger.info("Could not connect to host for remote_id: %s", remote_id)
|
logger.info("Could not connect to host for remote_id: %s", remote_id)
|
||||||
return None
|
return None
|
||||||
except requests.HTTPError as e:
|
except requests.HTTPError as e:
|
||||||
if (e.response is not None) and e.response.status_code == 401:
|
|
||||||
# This most likely means it's a mastodon with secure fetch enabled.
|
|
||||||
data = get_activitypub_data(remote_id)
|
|
||||||
else:
|
|
||||||
logger.info("Could not connect to host for remote_id: %s", remote_id)
|
logger.info("Could not connect to host for remote_id: %s", remote_id)
|
||||||
return None
|
return None
|
||||||
# determine the model implicitly, if not provided
|
# determine the model implicitly, if not provided
|
||||||
|
|
Loading…
Reference in a new issue