[ python-Bugs-1291446 ] SSLObject breaks read semantics

SourceForge.net noreply at sourceforge.net
Thu Sep 15 00:28:27 CEST 2005


Bugs item #1291446, was opened at 2005-09-14 22:28
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1291446&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Jonathan Ellis (ellisj)
Assigned to: Nobody/Anonymous (nobody)
Summary: SSLObject breaks read semantics

Initial Comment:
f = socket.ssl(sock)
f.read(n)

doesn't always return n bytes, even if the connection
remains open!  in particular, it seems to reproducibly
return less than n bytes if the read would span the
boundary between units of 16KB of data.

We've had to work around this with code like the following:

        pieces = []
        while n > 0:
            got = self.realfile.read(n)
            if not got:
                break
            pieces.append(got)
            n -= len(got)
        return ''.join(pieces)


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1291446&group_id=5470


More information about the Python-bugs-list mailing list