Benoit Chesneau f3190f84cc
feat: add PROXY protocol v2 support with version selection (#3451)
Extend --proxy-protocol to accept version values (off, v1, v2, auto) instead
of being boolean-only. This allows explicit control over which PROXY protocol
versions are accepted.

Changes:
- Add InvalidProxyHeader exception for v2 binary header errors
- Add validate_proxy_protocol() validator with backwards compatibility
- Update ProxyProtocol setting with nargs="?" and const="auto"
- Add PROXY v2 constants (PP_V2_SIGNATURE, PPCommand, PPFamily, PPProtocol)
- Add _parse_proxy_protocol_v1() and _parse_proxy_protocol_v2() methods
- Update both sync (message.py) and async (asgi/message.py) parsers
- Add hex escape handling in treq.py for v2 binary test data
- Add test cases for v2 TCPv4 and TCPv6

Backwards compatible: --proxy-protocol alone (or True) maps to "auto".

Closes #2912
2026-01-23 18:40:44 +01:00
..
2026-01-23 01:20:03 +01:00
2026-01-23 01:20:03 +01:00

Generate Documentation
======================

Requirements
------------

Install the documentation dependencies with::

    pip install -r requirements_dev.txt

This provides MkDocs with the Material theme and supporting plugins.


Build static HTML
-----------------
::

    mkdocs build

The rendered site is emitted into the ``site/`` directory.


Preview locally
---------------
::

    mkdocs serve

This serves the documentation at http://127.0.0.1:8000/ with live reload.