[issue12197] non-blocking SSL write in Windows sends large data but raises exception
David Siroky sir...@dasir.cz added the comment: I didn't meant blocking as setblocking(True). I use select/poll but I can't use returned value from send() immediately since in Windows there are often needed more send rounds to actually know how much data was sent. E.g. in Linux I know it after the first call: sslsock.write(abcd) - returns 2 poll(sslsock) sslsock.write(cd) in Windows I must do: sslsock.write(abcd) - raises SSLError poll(sslsock) sslsock.write(abcd) - returns 4 As I wrote it might be inconsistency in OpenSSL and not in Python's wrapper. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12197 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12197] non-blocking SSL write in Windows sends large data but raises exception
David Siroky sir...@dasir.cz added the comment: Sorry, I attached wrong example version. It uses repeated sslsock.write() of the same buffer after catching SSL_ERROR_WANT_WRITE. It delivers the full block but this is a blocking operation. I'm troubled with non-blocking writes. But as I dig deeper into the problem it looks like an inconsistency in OpenSSL (Linux vs. MSW). In Linux sslsock.write() always (as far as I can tell) sends some or all of the data and returns the amount. Like the plain socket.send(). In Windows it raises an exception if the data is larger then some uncertain size (mostly 16kB). I'm working on snakeMQ asynchronous messaging library where the packeter layer relies on the sock.send() returning actual amount of sent bytes. This is not working in Windows if the link uses SSL. Tested on WinXP, py2.6, py3.2. -- Added file: http://bugs.python.org/file22280/ssl_sock_test_fix.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12197 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12197] non-blocking SSL write in Windows sends large data but raises exception
Antoine Pitrou pit...@free.fr added the comment: Sorry, I attached wrong example version. It uses repeated sslsock.write() of the same buffer after catching SSL_ERROR_WANT_WRITE. It delivers the full block but this is a blocking operation. In normal non-blocking code you would use select() (or an equivalent) until the socket is ready for writing, and then send() some chunk of data on it. Can't you use that approach? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12197 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12197] non-blocking SSL write in Windows sends large data but raises exception
Changes by Giampaolo Rodola' g.rod...@gmail.com: -- nosy: +giampaolo.rodola ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12197 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12197] non-blocking SSL write in Windows sends large data but raises exception
Antoine Pitrou pit...@free.fr added the comment: Which version of Python are you testing on? It works fine using 3.2 and 3.3 here, under Windows 7 64-bit. Anyway, I would suggest to batch your write in smaller chunks (say, 2048 bytes each). Also, you may try sendall() instead. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12197 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12197] non-blocking SSL write in Windows sends large data but raises exception
New submission from David Siroky sir...@dasir.cz: Trying to send large bulk of data in MS Windows via non-blocking SSLSocket raises an exception but part of the data is delivered. E.g. ssl_socket.write(ba * 20) raises ssl.SSLError: [Errno 3] _ssl.c:1126: The operation did not complete (write) There is no way to get the sent bytes count which is essential in non-blocking communication. ssl_socket.send() returns 0. This should be unified with posix behavior. -- components: Extension Modules, Windows files: ssl_sock_test.py messages: 137092 nosy: dsiroky priority: normal severity: normal status: open title: non-blocking SSL write in Windows sends large data but raises exception type: behavior versions: Python 2.6, Python 3.2 Added file: http://bugs.python.org/file22157/ssl_sock_test.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12197 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com