From 30a818196ee23fcdc4709d4105ad301d4b372930 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Thu, 14 Sep 2000 20:34:27 +0000 Subject: [PATCH] cope with weird Content-Length values returned from servers by ignoring them; e.g. Zope sometimes returns 13497L --- Lib/httplib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/httplib.py b/Lib/httplib.py index eac59e38b03..1fe358e0b94 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -166,7 +166,10 @@ class HTTPResponse: # NOTE: RFC 2616, S4.4, #3 says we ignore this if tr_enc is "chunked" length = self.msg.getheader('content-length') if length and not self.chunked: - self.length = int(length) + try: + self.length = int(length) + except ValueError: + self.length = None else: self.length = None