Merge branch 'master' into next

Conflicts:
	Changelog.draft.rst
	offlineimap/imapserver.py
This commit is contained in:
Nicolas Sebrecht 2011-03-07 21:55:43 +01:00
commit 7b8d7501d1
3 changed files with 11 additions and 1 deletions

View File

@ -33,6 +33,7 @@ Changes
Bug Fixes
---------
* Fix hang because of infinite loop reading EOF.
* Allow SSL connections to send keep-alive messages.
* Fix regression (UIBase is no more).
* Make profiling mode really enforce single-threading

View File

@ -47,7 +47,10 @@ class IMAP4_Tunnel(IMAP4):
def read(self, size):
retval = ''
while len(retval) < size:
retval += self.infd.read(size - len(retval))
buf = self.infd.read(size - len(retval))
if not buf:
break
retval += buf
return retval
def readline(self):
@ -204,6 +207,8 @@ class WrappedIMAP4_SSL(IMAP4_SSL):
read = 0
while read < n:
data = self._read_upto (n-read)
if not data:
break
read += len(data)
chunks.append(data)
@ -216,6 +221,8 @@ class WrappedIMAP4_SSL(IMAP4_SSL):
retval = ''
while 1:
linebuf = self._read_upto(1024)
if not linebuf:
return retval
nlindex = linebuf.find("\n")
if nlindex != -1:
retval += linebuf[:nlindex + 1]

View File

@ -70,6 +70,8 @@ class UsefulIMAP4(UsefulIMAPMixIn, imaplibutil.WrappedIMAP4):
io = StringIO()
while read < size:
data = imaplib.IMAP4.read (self, min(size-read, 65536))
if not data:
break
read += len(data)
io.write(data)
return io.getvalue()