Pull requests / #1326

#1326 serve: support IPv6 bind addresses

open · @purrsec · 0 comentários · No GitHub

Setup & installServer & APISecurityDocumentation

Descrição

## The symptom

Starting the server with an IPv6 bind address such as `--host ::` fails before model loading:

```text
cannot listen on :::8081: Address family for hostname not supported [-9]
```

`ThreadingHTTPServer` inherits the IPv4-only `AF_INET` address family, so passing an IPv6 literal does not change the socket family.

## What changed

- Add an IPv6 `Server` subclass using `AF_INET6` and select it for IPv6 literals in both the startup preflight and the running server.
- Format IPv6 URLs with brackets and advertise `[::1]` as the local URL when listening on `::`.
- Keep the existing IPv4 path unchanged.
- Document `--host ::` in the CLI help, setup help, README, French README, and network details.
- Add a regression test that binds the real HTTP server to `::` and requests `/health` through `::1`.

An API key is still recommended whenever the server listens beyond loopback.

## Validation

- `python -m unittest serve.test_security -v`: 25 tests passed.
- `python -m unittest serve.test_server -q`: 204 tests passed.
- The IPv6 regression test performs a real wildcard bind and HTTP request, not only an address-family assertion.
- `python -m py_compile serve/server.py serve/test_security.py setup.py` passed.
- `git diff --check` passed.

No site

Links install, modelos, releases.