[New-bugs-announce] [issue31711] ssl.SSLSocket.send(b"") fails

Jörn Heissler report at bugs.python.org
Fri Oct 6 05:43:00 EDT 2017


New submission from Jörn Heissler <launchpad at joern.heissler.de>:

Traceback (most recent call last):
  File "client.py", line 10, in <module>
    conn.send(b'')
  File "/usr/lib/python3.6/ssl.py", line 941, in send
    return self._sslobj.write(data)
  File "/usr/lib/python3.6/ssl.py", line 642, in write
    return self._sslobj.write(data)
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2074)

This error is not what I expected. I expected a noop instead.

My guess is, that python calls SSL_write (3.6 branch, _ssl.c:2038) with that empty buffer.
The manpage states: "When calling SSL_write() with num=0 bytes to be sent the behaviour is undefined."

This undefined behaviour should either be documented in python, or defined to either raise an exception (ValueError?) or defined as a noop. I'd prefer the latter.

----------
assignee: christian.heimes
components: SSL
files: client.py
messages: 303810
nosy: christian.heimes, joernheissler
priority: normal
severity: normal
status: open
title: ssl.SSLSocket.send(b"") fails
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47194/client.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31711>
_______________________________________


More information about the New-bugs-announce mailing list