Bump http.server to 3.14 (#13981)

This commit is contained in:
Semyon Moroz
2025-05-11 11:56:08 +00:00
committed by GitHub
parent 268e1caab9
commit 9ce2a25b91
2 changed files with 51 additions and 8 deletions
@@ -119,9 +119,6 @@ fractions.Fraction.from_number
gzip.GzipFile.readinto
gzip.GzipFile.readinto1
gzip.compress
http.server.__all__
http.server.HTTPSServer
http.server.ThreadingHTTPSServer
imaplib.IMAP4.file
imaplib.IMAP4.idle
imaplib.IMAP4_SSL.file
+51 -5
View File
@@ -3,12 +3,25 @@ import email.message
import io
import socketserver
import sys
from _typeshed import StrPath, SupportsRead, SupportsWrite
from collections.abc import Mapping, Sequence
from typing import Any, AnyStr, BinaryIO, ClassVar
from typing_extensions import deprecated
from _ssl import _PasswordType
from _typeshed import ReadableBuffer, StrOrBytesPath, StrPath, SupportsRead, SupportsWrite
from collections.abc import Callable, Iterable, Mapping, Sequence
from ssl import Purpose, SSLContext
from typing import Any, AnyStr, BinaryIO, ClassVar, Protocol, type_check_only
from typing_extensions import Self, deprecated
__all__ = ["HTTPServer", "ThreadingHTTPServer", "BaseHTTPRequestHandler", "SimpleHTTPRequestHandler", "CGIHTTPRequestHandler"]
if sys.version_info >= (3, 14):
__all__ = [
"HTTPServer",
"ThreadingHTTPServer",
"HTTPSServer",
"ThreadingHTTPSServer",
"BaseHTTPRequestHandler",
"SimpleHTTPRequestHandler",
"CGIHTTPRequestHandler",
]
else:
__all__ = ["HTTPServer", "ThreadingHTTPServer", "BaseHTTPRequestHandler", "SimpleHTTPRequestHandler", "CGIHTTPRequestHandler"]
class HTTPServer(socketserver.TCPServer):
server_name: str
@@ -16,6 +29,39 @@ class HTTPServer(socketserver.TCPServer):
class ThreadingHTTPServer(socketserver.ThreadingMixIn, HTTPServer): ...
if sys.version_info >= (3, 14):
@type_check_only
class _SSLModule(Protocol):
@staticmethod
def create_default_context(
purpose: Purpose = ...,
*,
cafile: StrOrBytesPath | None = None,
capath: StrOrBytesPath | None = None,
cadata: str | ReadableBuffer | None = None,
) -> SSLContext: ...
class HTTPSServer(HTTPServer):
ssl: _SSLModule
certfile: StrOrBytesPath
keyfile: StrOrBytesPath | None
password: _PasswordType | None
alpn_protocols: Iterable[str]
def __init__(
self,
server_address: socketserver._AfInetAddress,
RequestHandlerClass: Callable[[Any, _socket._RetAddress, Self], socketserver.BaseRequestHandler],
bind_and_activate: bool = True,
*,
certfile: StrOrBytesPath,
keyfile: StrOrBytesPath | None = None,
password: _PasswordType | None = None,
alpn_protocols: Iterable[str] | None = None,
) -> None: ...
def server_activate(self) -> None: ...
class ThreadingHTTPSServer(socketserver.ThreadingMixIn, HTTPSServer): ...
class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
client_address: tuple[str, int]
close_connection: bool