mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Print out socket errors in HTTPS server thread
This commit is contained in:
parent
05d936d2ce
commit
84fa4314ba
1 changed files with 9 additions and 2 deletions
|
@ -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):
|
||||||
|
|
||||||
def get_request(self):
|
def get_request(self):
|
||||||
# override this to wrap socket with SSL
|
# override this to wrap socket with SSL
|
||||||
sock, addr = self.socket.accept()
|
try:
|
||||||
sslconn = self.context.wrap_socket(sock, server_side=True)
|
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
|
return sslconn, addr
|
||||||
|
|
||||||
class RootedHTTPRequestHandler(SimpleHTTPRequestHandler):
|
class RootedHTTPRequestHandler(SimpleHTTPRequestHandler):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue