[Patches] [ python-Patches-945642 ] nonblocking i/o with ssl socket
not working at all
SourceForge.net
noreply at sourceforge.net
Sun May 2 04:40:47 EDT 2004
Patches item #945642, was opened at 2004-05-01 00:14
Message generated for change (Comment added) made by tinolange
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=945642&group_id=5470
Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 7
Submitted By: Tino Lange (tinolange)
Assigned to: Nobody/Anonymous (nobody)
Summary: nonblocking i/o with ssl socket not working at all
Initial Comment:
Hi!
Unfortunately the applied patches #675750 and #676472
(End of January by G. Talvola / B. Laurie / G. v.
Rossum) for timeout-sockets in version 1.09 and 1.10 to
Modules/_ssl.c broke the nonblocking SSL I/O.
In fact sslobj.read() became *always* blocking -
whether the underlying socket is blocking or
nonblocking doesn't matter at all.
In Python < 2.3 this has worked correctly, starting
with 2.3, 2.3.x up to the current CVS it doesn't work
anymore.
Attached is a sample:
0) [ Preparation ]
Please run stunnel on your machine to have a SSL service:
/usr/sbin/stunnel -p /path/to/some/cert -f -d 4711 -r 4712
1) [ Server ]
Please run the easy server.py
2) [Client showing the bug]
Please run the client - and see how it hangs when you
use Python2.3.
Also attached is a diff against the current _ssl.c
which shows how to correct that behaviour while also
having the possibilities from the above timeout patches.
I carefully tested it, please review and test yourself
and finally check-in.
If you have questions, please don't hesitate to ask me.
I really would like to see that not only in 2.4, but
also (if possible together with patch #909007 from S.
Nicolary) in a 2.3.4 release. Otherwise 2.3.x wasn't at
all able to handle nonblocking SSL connections properly.
Thanks and cheers,
Tino
----------------------------------------------------------------------
>Comment By: Tino Lange (tinolange)
Date: 2004-05-02 10:40
Message:
Logged In: YES
user_id=212920
Hi JJ,
I just scanned your SocketServer.py - and I really don't see
how this class might help? You don't offer a better
sslob.read() there, don't you?
So how could it help (besides maybe making my example
"server.py nicer).
If I put a sslobj on top of a socket object it is blocking
in 2.3, 2.3.x and higher. As proven in my example: Making
the underlying socket nonblocking has no effect - because
SSL_ERROR_WANT_READ and SSL_ERROR_WANT_WRITE from the
SSL_xxx() functions in the C-Library do not break out of the
while loop that was introduced in the above mentioned patches.
Cheers,
Tino
----------------------------------------------------------------------
Comment By: Jesper ´JJ´ Jurcenoks (jesperjurcenoks)
Date: 2004-05-02 04:46
Message:
Logged In: YES
user_id=1033524
Hi Tino.
I just submitted a nonblocking SocketServer.py, it might just
solve your problem.
JJ
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=945642&group_id=5470
More information about the Patches
mailing list