Commit 84fa4314 authored by Antoine Pitrou's avatar Antoine Pitrou

Print out socket errors in HTTPS server thread

parent 05d936d2
...@@ -2,6 +2,7 @@ import os ...@@ -2,6 +2,7 @@ import os
import sys import sys
import ssl import ssl
import pprint import pprint
import socket
import threading import threading
import urllib.parse import urllib.parse
# Rename HTTPServer to _HTTPServer so as to avoid confusion with HTTPSServer. # Rename HTTPServer to _HTTPServer so as to avoid confusion with HTTPSServer.
...@@ -31,8 +32,14 @@ class HTTPSServer(_HTTPServer): ...@@ -31,8 +32,14 @@ class HTTPSServer(_HTTPServer):
def get_request(self): def get_request(self):
# override this to wrap socket with SSL # override this to wrap socket with SSL
try:
sock, addr = self.socket.accept() sock, addr = self.socket.accept()
sslconn = self.context.wrap_socket(sock, server_side=True) 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 return sslconn, addr
class RootedHTTPRequestHandler(SimpleHTTPRequestHandler): class RootedHTTPRequestHandler(SimpleHTTPRequestHandler):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment