mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-08-03 05:16:36 +08:00
Add support for IPv6
http.server supports IPv6, but the address has to be processed by _get_best_family
This commit is contained in:
parent
09b641aaa7
commit
12d1e968cc
@ -8,7 +8,7 @@ import time
|
|||||||
import uuid
|
import uuid
|
||||||
import warnings
|
import warnings
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
from http.server import BaseHTTPRequestHandler, HTTPServer, _get_best_family
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
@ -694,6 +694,7 @@ def run(
|
|||||||
):
|
):
|
||||||
server_address = (host, port)
|
server_address = (host, port)
|
||||||
prompt_cache = PromptCache()
|
prompt_cache = PromptCache()
|
||||||
|
server_class.address_family, server_address = _get_best_family(*server_address)
|
||||||
httpd = server_class(
|
httpd = server_class(
|
||||||
server_address,
|
server_address,
|
||||||
lambda *args, **kwargs: handler_class(
|
lambda *args, **kwargs: handler_class(
|
||||||
|
Loading…
Reference in New Issue
Block a user