Commit Diff


commit - d8322e0976a01ded7cd6a255f958f28f4cc597ca
commit + c1f94e6bc9e3217e15a20c82006bf3f5b92aaa78
blob - f341cc88b1c9c39cf914dd193ac8f1a671df85ff
blob + bf4da523d8a6f36c3e1044c0828eafc9b199b52d
--- yah2g.py
+++ yah2g.py
@@ -5,7 +5,7 @@ import xml.etree.ElementTree as ET
 from argparse import ArgumentParser
 from email.message import Message
 from http import HTTPStatus
-from http.server import HTTPServer, BaseHTTPRequestHandler
+from http.server import ThreadingHTTPServer, BaseHTTPRequestHandler
 from urllib.parse import parse_qs, urlparse, urljoin, urlencode, uses_relative, uses_netloc
 from contextlib import contextmanager
 
@@ -35,7 +35,7 @@ def _build_navigation(url=None):
     return ET.tostring(form) + b"\r\n"
 
 
-class _HTTPServer(HTTPServer):
+class _HTTPServer(ThreadingHTTPServer):
     def __init__(
         self,
         *args,
@@ -134,7 +134,7 @@ class _RequestHandler(BaseHTTPRequestHandler):
                         self.send_error(HTTPStatus.BAD_REQUEST, "Only gemini:// URLs are supported")
                         return
 
-                    context = ssl.SSLContext()
+                    context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
                     context.check_hostname = False
                     context.verify_mode = ssl.CERT_NONE
                     with socket.create_connection((parsed.hostname, parsed.port or 1965)) as raw_s: