mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 12:06:08 -04:00
i should have given up x2
This commit is contained in:
parent
8d16ffaf7a
commit
45524f2f5e
2 changed files with 52 additions and 18 deletions
|
@ -190,11 +190,11 @@ class MatrixFederationHttpClient(object):
|
|||
|
||||
@defer.inlineCallbacks
|
||||
def _send_request_with_optional_trailing_slash(
|
||||
self,
|
||||
request,
|
||||
try_trailing_slash_on_400=False,
|
||||
backoff_on_404=False,
|
||||
send_request_args={},
|
||||
self,
|
||||
request,
|
||||
try_trailing_slash_on_400=False,
|
||||
backoff_on_404=False,
|
||||
send_request_args={},
|
||||
):
|
||||
"""Wrapper for _send_request which can optionally retry the request
|
||||
upon receiving a combination of a 400 HTTP response code and a
|
||||
|
@ -213,8 +213,7 @@ class MatrixFederationHttpClient(object):
|
|||
`_send_request()`.
|
||||
|
||||
Returns:
|
||||
Deferred[twisted.web.client.Response]: resolves with the HTTP
|
||||
response object on success.
|
||||
Deferred[Dict]: Parsed JSON response body.
|
||||
"""
|
||||
response = yield self._send_request(**send_request_args)
|
||||
|
||||
|
@ -236,7 +235,11 @@ class MatrixFederationHttpClient(object):
|
|||
send_request_args["path"] += "/"
|
||||
response = yield self._send_request(**send_request_args)
|
||||
|
||||
defer.returnValue(response)
|
||||
body = yield _handle_json_response(
|
||||
self.hs.get_reactor(), self.default_timeout, request, response,
|
||||
)
|
||||
|
||||
defer.returnValue(body)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def _send_request(
|
||||
|
@ -585,14 +588,10 @@ class MatrixFederationHttpClient(object):
|
|||
"backoff_on_404": False if try_trailing_slash_on_400 else backoff_on_404,
|
||||
}
|
||||
|
||||
response = yield self._send_request_with_optional_trailing_slash(
|
||||
body = yield self._send_request_with_optional_trailing_slash(
|
||||
request, try_trailing_slash_on_400, backoff_on_404, send_request_args,
|
||||
)
|
||||
|
||||
body = yield _handle_json_response(
|
||||
self.hs.get_reactor(), self.default_timeout, request, response,
|
||||
)
|
||||
|
||||
defer.returnValue(body)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
|
@ -706,14 +705,10 @@ class MatrixFederationHttpClient(object):
|
|||
"backoff_on_404": False,
|
||||
}
|
||||
|
||||
response = yield self._send_request_with_optional_trailing_slash(
|
||||
body = yield self._send_request_with_optional_trailing_slash(
|
||||
request, try_trailing_slash_on_400, False, send_request_args,
|
||||
)
|
||||
|
||||
body = yield _handle_json_response(
|
||||
self.hs.get_reactor(), self.default_timeout, request, response,
|
||||
)
|
||||
|
||||
defer.returnValue(body)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue