From 2895f4bfdf1b6dd2fa9c7b5e3ce67c83b99e7376 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Wed, 11 Dec 2019 02:06:53 +0000 Subject: [PATCH] Catch TypeError in Content-Length parsing --- qwarc/aiohttp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qwarc/aiohttp.py b/qwarc/aiohttp.py index 23e7638..540376d 100644 --- a/qwarc/aiohttp.py +++ b/qwarc/aiohttp.py @@ -126,7 +126,7 @@ class ClientResponse(aiohttp.client_reqrep.ClientResponse): respMsg = aiohttp.http_parser.HttpResponseParserPy().parse_message(beginning[:pos + 2].split(b'\r\n')) try: length = int(self.headers.get('Content-Length')) - except (KeyError, ValueError): + except (KeyError, ValueError, TypeError): length = None parser = aiohttp.http_parser.HttpPayloadParser(payload, length = length, chunked = respMsg.chunked, compression = respMsg.compression, code = respMsg.code, method = self.method) eof, data = parser.feed_data(beginning[pos + 4:])