<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I see the socket.ssl() function accepts a socket object as its first
<br>parameter. Have you tried simply passing it an instance of<br>stacklesssocket?<br><font color="#888888"><br>Arnar<br></font></blockquote></div><br><br>I would expect to be doing the same thing as urllib with stacklesssocket here, but here goes:
<br>______________________________<div id="1f1h" class="ArwC7c ckChnd">______________________________________________________<br>import sys<br>import stacklesssocket<br>
import stackless<br>sys.modules[&quot;socket&quot;] = stacklesssocket<br>import socket<br><br># from <a href="http://docs.python.org/lib/socket-example.html" target="_blank">http://docs.python.org/lib/socket-example.html
</a>:<br>s = socket.socket
(socket.AF_INET, socket.SOCK_STREAM)<br>s.connect((&#39;<a href="http://www.verisign.com/" target="_blank">www.verisign.com</a>&#39;, 443))<br><br>ssl_sock = socket.ssl(s)<br><br>print repr(ssl_sock.server())<br>print repr(ssl_sock.issuer())
<br><br># Set a simple HTTP request -- use httplib in actual code.<br>ssl_sock.write(&quot;&quot;&quot;GET / HTTP/1.0\r<br>Host: www.verisign.com\r\n\r\n&quot;&quot;&quot;)<br><br># Read a chunk of data.&nbsp; Will not necessarily
<br># read all the data returned by the server.<br>data = ssl_sock.read()<br>print data.read()<br><br># Note that you need to close the underlying socket, not the SSL object.<br>del ssl_sock<br>s.close()<br><br>_________Result :___________________________________________________
<div class="Ih2E3d"><br><br>Traceback (most recent call last):<br></div>&nbsp; File &quot;ssl_socket_test.py&quot;, line 12, in &lt;module&gt;<br>&nbsp;&nbsp;&nbsp; ssl_sock = socket.ssl(s)<div class="Ih2E3d"><br>&nbsp; File &quot;/usr/lib/stackless/Lib/socket.py&quot;, line 74, in ssl
<br>&nbsp;&nbsp;&nbsp; return _realssl(sock, keyfile, certfile)
<br></div>socket.sslerror: (2, &#39;The operation did not complete (read)&#39;)<br>___________________________________________________________________<br>Yep, same thing...<br><br>This is not to put any pressure on you, Richard!&nbsp; Thanks for sharing =-)
<br><font color="#888888"><br><br>Phoenix Sol</font></div>