[Python-checkins] r85414 - python/branches/py3k/Lib/test/ssl_servers.py

antoine.pitrou python-checkins at python.org
Wed Oct 13 13:51:05 CEST 2010


Author: antoine.pitrou
Date: Wed Oct 13 13:51:05 2010
New Revision: 85414

Log:
Print out socket errors in HTTPS server thread



Modified:
   python/branches/py3k/Lib/test/ssl_servers.py

Modified: python/branches/py3k/Lib/test/ssl_servers.py
==============================================================================
--- python/branches/py3k/Lib/test/ssl_servers.py	(original)
+++ python/branches/py3k/Lib/test/ssl_servers.py	Wed Oct 13 13:51:05 2010
@@ -2,6 +2,7 @@
 import sys
 import ssl
 import pprint
+import socket
 import threading
 import urllib.parse
 # Rename HTTPServer to _HTTPServer so as to avoid confusion with HTTPSServer.
@@ -31,8 +32,14 @@
 
     def get_request(self):
         # override this to wrap socket with SSL
-        sock, addr = self.socket.accept()
-        sslconn = self.context.wrap_socket(sock, server_side=True)
+        try:
+            sock, addr = self.socket.accept()
+            sslconn = self.context.wrap_socket(sock, server_side=True)
+        except socket.error as e:
+            # socket errors are silenced by the caller, print them here
+            if support.verbose:
+                sys.stderr.write("Got an error:\n%s\n" % e)
+            raise
         return sslconn, addr
 
 class RootedHTTPRequestHandler(SimpleHTTPRequestHandler):


More information about the Python-checkins mailing list