[Zope-CVS] CVS: Packages/WebService - Transports.py:1.3 todo.txt:1.2
Brian Lloyd
brian@digicool.com
Thu, 29 Nov 2001 17:11:19 -0500
Update of /cvs-repository/Packages/WebService
In directory cvs.zope.org:/tmp/cvs-serv7534
Modified Files:
Transports.py todo.txt
Log Message:
Added some fixups for HTTPS connection timeouts.
=== Packages/WebService/Transports.py 1.2 => 1.3 ===
"""Manages the transport of SOAP messages over the HTTP protocol."""
- def __init__(self, timeout=20):
+ def __init__(self, key_file=None, cert_file=None, timeout=20):
+ self.key_file = key_file
+ self.cert_file = cert_file
self.timeout = timeout
self.redirects = {}
@@ -51,7 +53,10 @@
)
conn = TimeoutHTTPS(host, None, self.timeout)
else:
- conn = TimeoutHTTP(host, None, self.timeout)
+ conn = TimeoutHTTP(host, None, self.timeout,
+ key_file = self.key_file,
+ cert_file = self.cert_file
+ )
conn.putrequest(verb, path)
@@ -185,7 +190,7 @@
from smtplib import SMTP, SMTP_PORT
class TimeoutHTTP(HTTPConnection):
- """A custom http object that supports socket timeout."""
+ """A custom http connection object that supports socket timeout."""
def __init__(self, host, port=None, timeout=20):
HTTPConnection.__init__(self, host, port)
self.timeout = timeout
@@ -196,15 +201,20 @@
class TimeoutHTTPS(HTTPSConnection):
- """A custom http object that supports socket timeout."""
- def __init__(self, host, port=None, timeout=20):
- HTTPConnection.__init__(self, str(host), port)
+ """A custom https object that supports socket timeout. Note that this
+ is not really complete. The builtin SSL support in the Python socket
+ module requires a real socket (type) to be passed in to be hooked to
+ SSL. That means our fake socket won't work and our timeout hacks are
+ bypassed for send and recv calls. Since our hack _is_ in place at
+ connect() time, it should at least provide some timeout protection."""
+ def __init__(self, host, port=None, timeout=20, **kwargs):
+ HTTPSConnection.__init__(self, str(host), port, **kwargs)
self.timeout = timeout
def connect(self):
sock = TimeoutSocket(self.timeout)
sock.connect((self.host, self.port))
- realsock = getattr(sock, '_sock', sock)
+ realsock = getattr(sock.sock, '_sock', sock.sock)
ssl = socket.ssl(realsock, self.key_file, self.cert_file)
self.sock = httplib.FakeSocket(sock, ssl)
=== Packages/WebService/todo.txt 1.1 => 1.2 ===
- finish SOAPMessage docs
- - connection timeouts for WSDL & schema readers
-
- rethink Message params apis
- write getting started docs