gevent_openssl icon indicating copy to clipboard operation
gevent_openssl copied to clipboard

Connection.sendall is dangerously broken (can cause SSL3_WRITE_PENDING error)

Open wolever opened this issue 9 years ago • 1 comments

Currently calling Connection.sendall can cause a loop which re-sends data because __iowait will keep calling _connection.sendall with the same buffer, even if part of it has already been sent.

The fix, I believe, is to have a custom implementation of sendall which loops calling send, something like this:

def sendall(self, buf, flags=0):
    while buf:
        sent = self.send(buf, flags)
        buf = buf[sent:]

(albeit with the extra fiddly bits to make sure it works correctly for memoryview and buffer objects)

See also: https://github.com/gevent/gevent/issues/736

wolever avatar Feb 10 '16 21:02 wolever

Hey folk, any word on a fix here?

wolever avatar Feb 23 '17 21:02 wolever