From 6aa0249ea70125be2d45cd209ee969a571ab9457 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Sat, 2 Jun 2012 00:28:12 +0200 Subject: [PATCH] Updated httplib2.py from upstream. --- linkcheck/httplib2.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/linkcheck/httplib2.py b/linkcheck/httplib2.py index 116eac91..f36b361d 100644 --- a/linkcheck/httplib2.py +++ b/linkcheck/httplib2.py @@ -757,7 +757,11 @@ class HTTPConnection: line = response.fp.readline(_MAXLINE + 1) if len(line) > _MAXLINE: raise LineTooLong("header line") - if line == '\r\n': break + if not line: + # for sites which EOF without sending trailer + break + if line == '\r\n': + break def connect(self): """Connect to the host and port specified in __init__.""" @@ -1028,7 +1032,7 @@ class HTTPConnection: self.putrequest(method, url, **skips) - if body and ('content-length' not in header_names): + if body is not None and 'content-length' not in header_names: self._set_content_length(body) for hdr, value in headers.iteritems(): self.putheader(hdr, value)