[Python-bugs-list] [Bug #123924] Windows - using OpenSSL, problem with socket in httplib.py
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 11 Dec 2000 12:32:45 -0800
Bug #123924, was updated on 2000-Nov-30 06:11
Here is a current snapshot of the bug.
Project: Python
Category: Library
Status: Closed
Resolution: Fixed
Bug Group: Platform-specific
Priority: 5
Submitted by: ottobehrens
Assigned to : gvanrossum
Summary: Windows - using OpenSSL, problem with socket in httplib.py
Details: We found that when compiling python with USE_SSL on Windows, an exception occurred on the line:
ssl = socket.ssl(sock, self.key_file, self.cert_file)
The socket.ssl function expected arg 1 to be a socket object and not an instance of a class. We changed it to the following, which resolved the problem. However, this is not a generic solution and breaks again under Linux.
on class HTTPSConnection:
def connect(self):
"Connect to a host on a given (SSL) port."
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((self.host, self.port))
ssl = socket.ssl(sock._sock, self.key_file, self.cert_file)
self.sock = FakeSocket(sock, ssl)
Follow-Ups:
Date: 2000-Dec-11 12:32
By: gvanrossum
Comment:
Checked in as revision 1.24. Now let's hope that this works -- the submitter never wrote back.
-------------------------------------------------------
Date: 2000-Nov-30 06:15
By: gvanrossum
Comment:
Try this patch instead:
Index: httplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v
retrieving revision 1.24
diff -c -r1.24 httplib.py
*** httplib.py 2000/10/12 19:58:36 1.24
--- httplib.py 2000/11/30 14:14:43
***************
*** 613,619 ****
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((self.host, self.port))
! ssl = socket.ssl(sock, self.key_file, self.cert_file)
self.sock = FakeSocket(sock, ssl)
--- 613,622 ----
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((self.host, self.port))
! realsock = sock
! if hasattr(sock, "_sock"):
! realsock = sock._sock
! ssl = socket.ssl(realsock, self.key_file, self.cert_file)
self.sock = FakeSocket(sock, ssl)
-------------------------------------------------------
For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=123924&group_id=5470