summaryrefslogtreecommitdiffstats
path: root/Lib/test/ssl_servers.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-10-13 11:51:05 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-10-13 11:51:05 (GMT)
commit84fa4314ba410e39a6de873af39f145b47d39202 (patch)
tree99c310554fc82b9d246b0bb3c208b8bf149ce27d /Lib/test/ssl_servers.py
parent05d936d2cece5ac9dc31a9477c6849e499d2bd5b (diff)
downloadcpython-84fa4314ba410e39a6de873af39f145b47d39202.zip
cpython-84fa4314ba410e39a6de873af39f145b47d39202.tar.gz
cpython-84fa4314ba410e39a6de873af39f145b47d39202.tar.bz2
Print out socket errors in HTTPS server thread
Diffstat (limited to 'Lib/test/ssl_servers.py')
-rw-r--r--Lib/test/ssl_servers.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/test/ssl_servers.py b/Lib/test/ssl_servers.py
index a0b77b5..914a943 100644
--- a/Lib/test/ssl_servers.py
+++ b/Lib/test/ssl_servers.py
@@ -2,6 +2,7 @@ import os
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 @@ class HTTPSServer(_HTTPServer):
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):