diff --git a/extra/keepalive/keepalive.py b/extra/keepalive/keepalive.py index 9b4d26076..8cdc41f97 100644 --- a/extra/keepalive/keepalive.py +++ b/extra/keepalive/keepalive.py @@ -295,10 +295,10 @@ class HTTPResponse(httplib.HTTPResponse): class HTTPConnection(httplib.HTTPConnection): # use the modified response class response_class = HTTPResponse - _headers = {} + _headers = None def clearheaders(self): - self._headers.clear() + self._headers = {} def putheader(self, header, value): """Send a request header line to the server. diff --git a/lib/request/connect.py b/lib/request/connect.py index bb766369b..94155b730 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -347,10 +347,7 @@ class Connect: if kb.nullConnection == "HEAD": pageLength = int(headers['Content-Length']) elif kb.nullConnection == "Range": - if 'Content-Range' in headers: - pageLength = int(headers['Content-Range'][headers['Content-Range'].find('/') + 1:]) - elif 'content-length' in headers: #sometimes - pageLength = int(headers['content-length']) + pageLength = int(headers['Content-Range'][headers['Content-Range'].find('/') + 1:]) if not pageLength: page, headers = Connect.getPage(url=uri, get=get, post=post, cookie=cookie, ua=ua, silent=silent, method=method, auxHeaders=auxHeaders, response=response, raise404=raise404)