This is an old revision of the document!
bugs
change
data = self.sslobj.read(size-read)
to
data = self.sslobj.read(min(size-read, 16384))