You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Added
Windows support (x86-64, Python 3.12-3.14 and 3.14t). PyPI gets win_amd64 wheels with nghttp2, Brotli 1.2.1, zstd, and zlib linked
statically. A source build needs MSVC plus scripts/build-native-deps.ps1, which builds those libraries with vcpkg
pinned to one commit and prints the PKG_CONFIG / PKG_CONFIG_PATH
values for setup.py; PKG_CONFIG now names the pkg-config binary on
every platform. On Windows:
The server runs one event loop on the stdlib proactor loop: there is no SO_REUSEPORT, so STARIO_THREADS stays at 1. Unix sockets and uvloop
are unavailable (the uvloop extra installs nothing there).
Ctrl+Break (SIGBREAK) starts a graceful shutdown like Ctrl+C, since
Windows never delivers SIGTERM to a console process.
reuse_addr is ignored: SO_REUSEADDR there lets a second socket bind
the same port instead of rebinding past TIME_WAIT.
Winsock takes a whole send into kernel memory while the send buffer has
room, however large: a big one-shot respond() to a client that is not
reading is held by the kernel rather than aborted after write_timeout.
Streamed bodies (w.write + await w.drain(), Files) stay bounded. Files opens files without delete sharing, so replacing a file while it
is streamed fails until the response ends.
Files opens files in binary mode, treats directory junctions as
symlinks, and answers 404 for names Win32 would not open as written:
reserved characters (<>:"|?*, controls), a drive or NTFS stream
colon (C:x, a.txt::$DATA), a trailing dot or space (app.py. would
open app.py), and device names (CON, NUL.txt, COM1). With include_hidden=False the resolved path is checked again, so an 8.3
short name (GIT~1) cannot reach a dot directory.
Security
Files checks that the file it opened is the one path resolution vetted:
the OS's own path for the open file (Linux /proc/self/fd, macOS F_GETPATH, Windows GetFinalPathNameByHandleW) must equal the vetted
path, so a link swapped into any component between the checks and the
open (by a local user who can write the served tree) is a 404. Where the
OS cannot say, the device and inode stand in. On a mismatch it resolves
once more, so a deploy that replaces files still serves the new file.
With include_hidden=False, Files refuses a path segment that names a
file only through an NTFS/FAT 8.3 alias (GIT~1 for .git) on Linux and
macOS too, where an ntfs-3g, vfat, or SMB mount (or WSL's /mnt/c)
answers to short names that realpath() never expands. A segment shaped
like an alias must appear verbatim in its directory listing.
On Windows, any name-surrogate reparse point (junction, WSL or container
link), not only a symlink or junction, counts as a link for follow_symlinks=False.
Fixed
Files answers 404, not 500, for a path segment longer than 255
characters, a path longer than 4096, or a name the filesystem rejects as
too long (ENAMETOOLONG, or a name Windows cannot represent).
A Files or Assets stream cancelled mid-read (a client reset) closes
its file only after the worker thread's read returns. On Windows the
close used to block the event loop on the CRT's descriptor lock, and the lseek + read fallback could read from a reused descriptor.
The request body byte counter is Py_ssize_t, like the limits it is
compared with; as an int it wrapped after 2 GiB of discarded HTTP/2 DATA.