summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2016-03-31 12:42:27 +0100
committerMatthew Hodgson <matthew@matrix.org>2016-03-31 12:42:27 +0100
commit0d3d7de6fcb98972532bf9aaa983ddd8befb3db8 (patch)
tree7912cf661ab36baf71112e4f609a423450287f96 /synapse
parenthandle requests with missing content-length headers (e.g. YouTube) (diff)
downloadsynapse-0d3d7de6fcb98972532bf9aaa983ddd8befb3db8.tar.xz
sync in changes from matrixfederationclient
Diffstat (limited to 'synapse')
-rw-r--r--synapse/http/client.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py
index 30f31a915d..219b734268 100644
--- a/synapse/http/client.py
+++ b/synapse/http/client.py
@@ -244,7 +244,7 @@ class SimpleHttpClient(object):
     # The two should be factored out.
 
     @defer.inlineCallbacks
-    def get_file(self, url, output_stream, args={}, max_size=None):
+    def get_file(self, url, output_stream, max_size=None):
         """GETs a file from a given URL
         Args:
             url (str): The URL to GET
@@ -299,7 +299,11 @@ class _ReadBodyToFileProtocol(protocol.Protocol):
         self.stream.write(data)
         self.length += len(data)
         if self.max_size is not None and self.length >= self.max_size:
-            logger.warn("Requested URL is too large > %r bytes" % (self.max_size,))
+            self.deferred.errback(SynapseError(
+                502,
+                "Requested file is too large > %r bytes" % (self.max_size,),
+                Codes.TOO_LARGE,
+            ))
             self.deferred = defer.Deferred()
             self.transport.loseConnection()