M2Crypto.SSL.SSLServer, handle_error should take 2 arguments
John Meinel <[email protected]>
| Newsgroups | gmane.comp.python.cryptography |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm wanting to setup an M2Crypto SSLServer for an application I have. I noticed that the standard SocketServer has an overrideable function called "handle_error", if you look in the python documentation, this takes 2 arguments (plus self). The SSLServer only takes one. I realize that in the context they are calling handle_error() some of the properties are not defined. (There may not be a client_address yet) However, I am concerned if there is an error later (such as in process_request_thread, or process_request for the Forking server) that instead of getting the error handled, it will raise a TypeError. Attached is a small patch that I think fixes this problem. It would also be nice if the SSLError object could contain information about what client is connecting. That way you could figure out if there was a specific machine that was trying to connect and was having difficulty negotiating the connection. It wouldn't have to be sent as parameters to the function, if it was just part of the SSLError string, that would still be helpful. John =:-> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBAuMIJdeBCYSNAAMRAm8YAJ9BqZUrWGb9J0lSbCzyW8tw+N92CwCcDfa/ igFIox0Tr/WzbPFHYA7OjsI= =R3pT -----END PGP SIGNATURE-----
SSLServer.patch
(text/x-patch, 732 B)
--- original/SSLServer.py 2004-07-24 17:23:48.539550629 -0500
+++ mod/SSLServer.py 2004-07-24 17:23:25.101089458 -0500
@@ -25,14 +25,15 @@
self.server_activate()
def handle_request(self):
+ request, client_address = None, None
try:
request, client_address = self.get_request()
if self.verify_request(request, client_address):
self.process_request(request, client_address)
except SSLError:
- self.handle_error()
+ self.handle_error(request, client_address)
- def handle_error(self):
+ def handle_error(self, request, client_address):
print '-'*40
import traceback
traceback.print_exc()