diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2018-09-14 03:11:25 +1000 |
---|---|---|
committer | Amber Brown <hawkowl@atleastfornow.net> | 2018-09-14 03:11:25 +1000 |
commit | 73884ebac59f091ac44cf81b7fb8854cdd4a3785 (patch) | |
tree | 63890fa9d273b69a19fa581e1dce83eb4ab55b38 /synapse/http/client.py | |
parent | buffer? (diff) | |
parent | merge (#3576) (diff) | |
download | synapse-73884ebac59f091ac44cf81b7fb8854cdd4a3785.tar.xz |
Merge remote-tracking branch 'origin/develop' into hawkowl/timeouts-2
Diffstat (limited to 'synapse/http/client.py')
-rw-r--r-- | synapse/http/client.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py index 4ba54fed05..d60f87b04e 100644 --- a/synapse/http/client.py +++ b/synapse/http/client.py @@ -348,7 +348,8 @@ class SimpleHttpClient(object): resp_headers = dict(response.headers.getAllRawHeaders()) - if 'Content-Length' in resp_headers and resp_headers['Content-Length'] > max_size: + if (b'Content-Length' in resp_headers and + int(resp_headers[b'Content-Length']) > max_size): logger.warn("Requested URL is too large > %r bytes" % (self.max_size,)) raise SynapseError( 502, @@ -381,7 +382,12 @@ class SimpleHttpClient(object): ) defer.returnValue( - (length, resp_headers, response.request.absoluteURI, response.code), + ( + length, + resp_headers, + response.request.absoluteURI.decode('ascii'), + response.code, + ), ) @@ -466,9 +472,9 @@ class SpiderEndpointFactory(object): def endpointForURI(self, uri): logger.info("Getting endpoint for %s", uri.toBytes()) - if uri.scheme == "http": + if uri.scheme == b"http": endpoint_factory = HostnameEndpoint - elif uri.scheme == "https": + elif uri.scheme == b"https": tlsCreator = self.policyForHTTPS.creatorForNetloc(uri.host, uri.port) def endpoint_factory(reactor, host, port, **kw): |