diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-09-14 20:34:27 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-09-14 20:34:27 (GMT) |
commit | 30a818196ee23fcdc4709d4105ad301d4b372930 (patch) | |
tree | d653dff9b72bdfc1bb5f1ab841619341ae3d5877 /Lib/httplib.py | |
parent | 7a666b83c8d4d1753b4d718ef3f056bf230e2206 (diff) | |
download | cpython-30a818196ee23fcdc4709d4105ad301d4b372930.zip cpython-30a818196ee23fcdc4709d4105ad301d4b372930.tar.gz cpython-30a818196ee23fcdc4709d4105ad301d4b372930.tar.bz2 |
cope with weird Content-Length values returned from servers by
ignoring them; e.g. Zope sometimes returns 13497L
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r-- | Lib/httplib.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py index eac59e3..1fe358e 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 |