[Patches] [ python-Patches-409287 ] ssl fix when using _socketobject
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 23 Mar 2001 08:36:14 -0800
Patches item #409287, was updated on 2001-03-16 16:51
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=409287&group_id=5470
Category: library
Group: None
Status: Closed
Priority: 5
Submitted By: Robin Dunn (robind)
Assigned to: Guido van Rossum (gvanrossum)
Summary: ssl fix when using _socketobject
Initial Comment:
On windows and other platforms _socketobject instances
are used instead of the raw extension type. This
breaks the _socket.ssl function which is expecting an
extension type parameter.
This patch makes a wrapper for socket.ssl similar to
socket.socket when _socketobjects are used.
This patch is for 2.0 but it looks like it will work
the same in 2.1
*** socket.orig.py Fri Mar 16 16:23:38 2001
--- socket.py Fri Mar 16 16:25:52 2001
***************
*** 51,58 ****
--- 51,67 ----
except NameError:
_realsocketcall = socket
+ try:
+ _realsslcall
+ except NameError:
+ _realsslcall = ssl
+
def socket(family, type, proto=0):
return _socketobject(_realsocketcall(family,
type, proto))
+
+ def ssl(sock, keyfile=None, certfile=None):
+ return _realsslcall(sock._sock, keyfile,
certfile)
+
# WSA error codes
----------------------------------------------------------------------
>Comment By: Robin Dunn (robind)
Date: 2001-03-23 08:36
Message:
Logged In: YES
user_id=53955
Your change works for me when back-ported to 2.0's
socket.py.
Thanks!
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2001-03-22 14:12
Message:
Logged In: YES
user_id=6380
I've fixed this. The patch is slightly different, it turns
out that your patch doesn't work when _socket.ssl doesn't
exist. Please test what I checked in because I don't have
SSL on my Windows box.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=409287&group_id=5470