Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-134168: http.server with HTTPS fails to bind IPv6 addresses and ignores --directory flag#134169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ggqlq wants to merge11 commits intopython:main
base:main
Choose a base branch
Loading
fromggqlq:fix_http_cli
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletionsLib/http/server.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -980,8 +980,8 @@ def test(HandlerClass=BaseHTTPRequestHandler,
HandlerClass.protocol_version = protocol

if tls_cert:
server =ThreadingHTTPSServer(addr, HandlerClass, certfile=tls_cert,
keyfile=tls_key, password=tls_password)
server =ServerClass(addr, HandlerClass, certfile=tls_cert,
keyfile=tls_key, password=tls_password)
else:
server = ServerClass(addr, HandlerClass)

Expand DownExpand Up@@ -1041,7 +1041,7 @@ def _main(args=None):
parser.error(f"Failed to read TLS password file: {e}")

# ensure dual-stack is not disabled; ref #38907
classDualStackServer(ThreadingHTTPServer):
classDualStackServerMixin:

def server_bind(self):
# suppress exception when protocol is IPv4
Expand All@@ -1054,9 +1054,16 @@ def finish_request(self, request, client_address):
self.RequestHandlerClass(request, client_address, self,
directory=args.directory)

class HTTPDualStackServer(DualStackServerMixin, ThreadingHTTPServer):
pass
class HTTPSDualStackServer(DualStackServerMixin, ThreadingHTTPSServer):
pass

ServerClass = HTTPSDualStackServer if args.tls_cert else HTTPDualStackServer

test(
HandlerClass=SimpleHTTPRequestHandler,
ServerClass=DualStackServer,
ServerClass=ServerClass,
port=args.port,
bind=args.bind,
protocol=args.protocol,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
:mod:`http.server`: Fix IPv6 address binding and
:option:`--directory <http.server --directory>` handling when using HTTPS.
Loading

[8]ページ先頭

©2009-2025 Movatter.jp