diff options
author | Richard van der Hoff <github@rvanderhoff.org.uk> | 2017-03-14 23:40:35 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-14 23:40:35 +0000 |
commit | f2ed64eaaf4054268d64863e512ba90f2000ee0d (patch) | |
tree | b15cea665b7886791c325bbe9dd0849f0b68435d /synapse/http | |
parent | Merge pull request #2002 from matrix-org/erikj/dont_sync_by_default (diff) | |
parent | kick jenkins (diff) | |
download | synapse-f2ed64eaaf4054268d64863e512ba90f2000ee0d.tar.xz |
Merge pull request #1992 from matrix-org/rav/fix_media_loop
Fix routing loop when fetching remote media
Diffstat (limited to 'synapse/http')
-rw-r--r-- | synapse/http/matrixfederationclient.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/synapse/http/matrixfederationclient.py b/synapse/http/matrixfederationclient.py index 78b92cef36..82586e3dea 100644 --- a/synapse/http/matrixfederationclient.py +++ b/synapse/http/matrixfederationclient.py @@ -108,6 +108,12 @@ class MatrixFederationHttpClient(object): query_bytes=b"", retry_on_dns_fail=True, timeout=None, long_retries=False): """ Creates and sends a request to the given url + + Returns: + Deferred: resolves with the http response object on success. + + Fails with ``HTTPRequestException``: if we get an HTTP response + code >= 300. """ headers_dict[b"User-Agent"] = [self.version_string] headers_dict[b"Host"] = [destination] @@ -408,8 +414,11 @@ class MatrixFederationHttpClient(object): output_stream (file): File to write the response body to. args (dict): Optional dictionary used to create the query string. Returns: - A (int,dict) tuple of the file length and a dict of the response - headers. + Deferred: resolves with an (int,dict) tuple of the file length and + a dict of the response headers. + + Fails with ``HTTPRequestException`` if we get an HTTP response code + >= 300 """ encoded_args = {} @@ -419,7 +428,7 @@ class MatrixFederationHttpClient(object): encoded_args[k] = [v.encode("UTF-8") for v in vs] query_bytes = urllib.urlencode(encoded_args, True) - logger.debug("Query bytes: %s Retry DNS: %s", args, retry_on_dns_fail) + logger.debug("Query bytes: %s Retry DNS: %s", query_bytes, retry_on_dns_fail) def body_callback(method, url_bytes, headers_dict): self.sign_request(destination, method, url_bytes, headers_dict) |