major bug fix for --keep-alive option in multithreading mode (that 'shitty' _headers = {} made a one shared object for all connection objects)

This commit is contained in:
Miroslav Stampar 2010-10-13 23:01:23 +00:00
parent 36ef8ca575
commit dc50543ea4
2 changed files with 3 additions and 6 deletions

View File

@ -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.

View File

@ -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)