diff --git a/Lib/http/server.py b/Lib/http/server.py index e571418cc00..b79d191fbb4 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -105,6 +105,7 @@ import copy DEFAULT_ERROR_MESSAGE = """\ + Error response @@ -734,10 +735,16 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): list.sort(key=lambda a: a.lower()) r = [] displaypath = html.escape(urllib.parse.unquote(self.path)) - r.append('') - r.append("\nDirectory listing for %s\n" % displaypath) - r.append("\n

Directory listing for %s

\n" % displaypath) - r.append("
\n\n
\n\n\n') + encoded = '\n'.join(r).encode(enc) f = io.BytesIO() f.write(encoded) f.seek(0) diff --git a/Misc/NEWS b/Misc/NEWS index 3cd76218fe1..c751ba689c7 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -350,6 +350,8 @@ Core and Builtins Library ------- +- Issue #13295: http.server now produces valid HTML 4.01 strict. + - Issue #2892: preserve iterparse events in case of SyntaxError. - Issue #13287: urllib.request and urllib.error now contains a __all__ and