mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-22 15:14:44 +00:00
updated from python CVS
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2741 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
f986fa179f
commit
5b5eda36e4
2 changed files with 8 additions and 3 deletions
|
|
@ -55,6 +55,7 @@ class GzipFile:
|
|||
"""
|
||||
|
||||
myfileobj = None
|
||||
max_read_chunk = 10 * 1024 * 1024 # 10Mb
|
||||
|
||||
def __init__(self, filename=None, mode=None,
|
||||
compresslevel=9, fileobj=None):
|
||||
|
|
@ -215,14 +216,14 @@ class GzipFile:
|
|||
try:
|
||||
while True:
|
||||
self._read(readsize)
|
||||
readsize = readsize * 2
|
||||
readsize = min(self.max_read_chunk, readsize * 2)
|
||||
except EOFError:
|
||||
size = self.extrasize
|
||||
else: # just get some more of it
|
||||
try:
|
||||
while size > self.extrasize:
|
||||
self._read(readsize)
|
||||
readsize = readsize * 2
|
||||
readsize = min(self.max_read_chunk, readsize * 2)
|
||||
except EOFError:
|
||||
if size > self.extrasize:
|
||||
size = self.extrasize
|
||||
|
|
@ -336,7 +337,10 @@ class GzipFile:
|
|||
return
|
||||
self.close()
|
||||
|
||||
def flush(self):
|
||||
def flush(self,zlib_mode=zlib.Z_SYNC_FLUSH):
|
||||
if self.mode == WRITE:
|
||||
# Ensure the compressor's buffer is flushed
|
||||
self.fileobj.write(self.compress.flush(zlib_mode))
|
||||
self.fileobj.flush()
|
||||
|
||||
def fileno(self):
|
||||
|
|
|
|||
|
|
@ -354,6 +354,7 @@ class HTTPResponse:
|
|||
raise UnknownProtocol(version)
|
||||
|
||||
if self.version == 9:
|
||||
self.length = None
|
||||
self.chunked = 0
|
||||
self.will_close = 1
|
||||
self.msg = HTTPMessage(StringIO())
|
||||
|
|
|
|||
Loading…
Reference in a new issue