| toc_depth | 2 |
|---|
HTTP/2 support remains experimental. Install zttp>=0.0.34 and enable it with --http zttp --http2.
- Add HTTP/2 response trailers through the ASGI
http.response.trailersextension. Clients must sendTE: trailersto receive them (#3146) - Add HTTP/2
103 Early Hintsthrough the ASGIhttp.response.early_hintextension (#3137)
This release adds experimental HTTP/2 support through zttp. Enable it with --http zttp --http2.
Upgrade-based h2c and WebSockets over HTTP/2 are not supported.
- Handle comma-separated, case-insensitive
Connection: closetokens across HTTP implementations (#3103) - Trust IPv6 loopback in the default
FORWARDED_ALLOW_IPSvalue (#3119) - Cancel the HTTP keep-alive timer when upgrading to WebSocket (#3107)
- Remove duplicate
Dateheaders from accepted WebSocket handshakes withwebsockets-sansio(#3078)
- Update
zttpto 0.0.24 and use its combined receive path, improving HTTP/1.1 request parsing performance (#3067)
- Update
zttpto 0.0.22, fixing bodyless request receives and improving HTTP/1 request parsing performance (#3063)
- Complete the closing handshake on server-initiated WebSocket closes in the
websockets-sansioandwsprotoimplementations, waiting for the client's close reply with a 10 second timeout instead of resetting the connection (#3053) - Add missing write flow control to the
websockets-sansioimplementation, preventing data truncation on server-initiated closes with large in-flight payloads (#3048) - Handle connection loss while a WebSocket write is waiting on backpressure (#3050)
- Remove duplicate
Content-TypeandContent-Lengthheaders from WebSocket denial responses on thewebsockets-sansioimplementation, and deliver non-UTF-8 denial bodies intact (#3041)
This release adds an experimental HTTP/1.1 implementation backed by zttp, a sans-IO HTTP parser I've been developing on the side: a core written in Zig, with bindings to Python. It has been running under a fuzzer for some weeks now, and has been through multiple rounds of security auditing.
It is still experimental, so don't put it in front of production traffic yet. Try it with --http zttp, and please send any feedback to the issue tracker.
- Add an experimental
zttpHTTP/1.1 implementation, selectable with--http zttp(#2979)
- Keep non-ASCII WebSocket request headers intact with websockets 17.0, which encodes them with ISO-8859-1 (#3036)
- Restart workers one at a time on
SIGHUP, bringing each replacement up before retiring the old worker, so reloads no longer drop requests (#3025)
- Remove
coloramafrom thestandardextra (#3027)
- Require
websockets>=13.0, which the defaultwebsockets-sansioimplementation needs (#3021)
- Split comma-separated
Sec-WebSocket-Protocolvalues in thewebsockets-sansioimplementation (#3019)
If you use WebSockets, note that --ws auto now picks the websockets-sansio implementation. You shouldn't need it, but you can pin --ws websockets to get the deprecated legacy one back.
- Exit with the dedicated code 3 on any startup failure: app loading, socket bind and lifespan startup errors previously exited with a mix of 0, 1 and 3 (#3001)
- Stop the multiprocess supervisor when a worker exits with code 3 instead of restarting it forever (#3001)
- Default
--ws autotowebsockets-sansiowhen websockets is installed (#2985) - Skip the eager app import in the parent process with
--reloador--workers, fixing a memory regression introduced in 0.47.0 (#3012) - Build a fresh
asgiscope dict per request (#2977) - Cache the
asgiscope sub-dict per connection (#2976) - Avoid copying single-frame WebSocket payloads in
websockets-sansio(#2983) - Memoize trusted host checks in
ProxyHeadersMiddleware(#2970) - Replace
click.stylewith an internal ANSI style helper (#2981)
- Deprecate the legacy
websocketsimplementation; usewebsockets-sansioorwsprotoinstead (#2985)
- Bump
httptoolsminimum version to 0.8.0 (#2962) - Consume duplicate forwarding headers in
ProxyHeadersMiddleware(reverses the 0.48.0 behavior of ignoring them) (#2971)
- Default
ssl_cipherstoNoneand use OpenSSL defaults (#2940)
- Ignore duplicate forwarding headers in
ProxyHeadersMiddleware(#2944)
- Add
ssl_context_factoryfor customSSLContextconfiguration (#2920)
- Eagerly import the ASGI app in the parent process (#2919)
- Treat
fd=0as a valid file descriptor with reload/workers (#2927)
- Support
ws_max_sizeinwsprotoimplementation (#2915) - Support
ws_ping_intervalandws_ping_timeoutinwsprotoimplementation (#2916)
- Use
bytearrayfor incoming WebSocket message buffer inwebsockets-sansio(#2917)
- Add
--reset-contextvarsflag to isolate ASGI request context (#2912) - Accept
os.PathLikeforlog_config(#2905) - Accept
log_levelstrings case-insensitively (#2907)
- Revert "Emit
http.disconnecton server shutdown for streaming responses" (#2913) - Revert "Explicitly start ASGI run with empty context" (#2911)
- Preserve forwarded client ports in proxy headers middleware (#2903)
- Raise helpful
ImportErrorwhen PyYAML is missing for YAML log config (#2906)
- Implement websocket keepalive pings for websockets-sansio (#2888)
You can quit Uvicorn now. We heard you, @pamelafox - all 47 of your Ctrl+C's (thanks for flagging it, and thanks to @tiangolo for the fix 🙏). See the tweet.
- Emit
http.disconnectASGIreceive()event on server shutting down for streaming responses (#2829) - Use native
contextparameter forcreate_taskon Python 3.11+ (#2859) - Drop cast in ASGI types (#2875)
- Use
bytearrayfor request body accumulation to avoid O(n^2) allocation on fragmented bodies (#2845)
- Escape brackets and backslash in httptools
HEADER_REregex (#2824) - Fix multiple issues in websockets sans-io implementation (#2825)
- Add
--limit-max-requests-jitterto stagger worker restarts (#2707) - Add socket path to
scope["server"](#2561)
- Rename
LifespanOn.error_occuredtoerror_occurred(#2776)
- Ignore permission denied errors in watchfiles reloader (#2817)
- Ensure lifespan shutdown runs when
should_exitis set during startup (#2812) - Reduce the log level of 'request limit exceeded' messages (#2788)
- Drop support for Python 3.9 (#2772)
- Send close frame on ASGI return for WebSockets (#2769)
- Explicitly start ASGI run with empty context (#2742)
- Support Python 3.14 (#2723)
- Add
--timeout-worker-healthcheckoption (#2711) - Add
os.PathLike[str]type tossl_ca_certs(#2676)
- Raise an exception when calling removed
Config.setup_event_loop()(#2709)
- Support custom IOLOOPs (#2435)
- Allow to provide importable string in
--http,--wsand--loop(#2658)
- Add
WebSocketsSansIOProtocol(#2540)
- Refine help message for option
--proxy-headers(#2653)
- Don't include
cwd()when non-empty--reload-dirsis passed (#2598) - Apply
get_client_addrformatting to WebSocket logging (#2636)
- Flush stdout buffer on Windows to trigger reload (#2604)
- Deprecate
ServerStatein the main module (#2581)
- Add
content-lengthto 500 response inwsprotoimplementation (#2542)
- Drop support for Python 3.8 (#2543)
- Remove
WatchGodsupport for--reload(#2536)
- Drop ASGI spec version to 2.3 on HTTP scope (#2513)
- Enable httptools lenient data on
httptools >= 0.6.3(#2488)
- Officially support Python 3.13 (#2482)
- Warn when
max_request_limitis exceeded (#2430)
- Support WebSockets 0.13.1 (#2471)
- Restore support for
[*]in trusted hosts (#2480) - Add
PathLike[str]type hint forssl_keyfile(#2481)
Improve ProxyHeadersMiddleware (#2468) and (#2231):
- Fix the host for requests from clients running on the proxy server itself.
- Fallback to host that was already set for empty x-forwarded-for headers.
- Also allow to specify IP Networks as trusted hosts. This greatly simplifies deployments
on docker swarm/kubernetes, where the reverse proxy might have a dynamic IP.
- This includes support for IPv6 Address/Networks.
- Don't warn when upgrade is not WebSocket and dependencies are installed (#2360)
- Don't close connection before receiving body on H11 (#2408)
- Close connection when
h11sets client state toMUST_CLOSE(#2375)
- Suppress
KeyboardInterruptfrom CLI and programmatic usage (#2384) ClientDisconnectinherits fromOSErrorinstead ofIOError(#2393)
- Add
reasonsupport towebsocket.disconnectevent (#2324)
- Iterate subprocesses in-place on the process manager (#2373)
- Allow horizontal tabs
\tin response header values (#2345)
- New multiprocess manager (#2183)
- Allow
ConfigParseror aio.IO[Any]onlog_config(#1976)
- Suppress side-effects of signal propagation (#2317)
- Send
content-lengthheader on 5xx (#2304)
- Deprecate the
uvicorn.workersmodule (#2302)
- Cooperative signal handling (#1600)
- Revert raise
ClientDisconnectedon HTTP (#2276)
- Raise
ClientDisconnectedonsend()when client disconnected (#2220)
- Except
AttributeErroronsys.stdin.fileno()for Windows IIS10 (#1947) - Use
X-Forwarded-Protofor WebSockets scheme when the proxy provides it (#2258)
- Fix spurious LocalProtocolError errors when processing pipelined requests (#2243)
- Fix nav overrides for newer version of Mkdocs Material (#2233)
- Raise
ClientDisconnect(IOError)onsend()when client disconnected (#2218) - Bump ASGI WebSocket spec version to 2.4 (#2221)
- Update
--root-pathto include the root path prefix in the full ASGIpathas per the ASGI spec (#2213) - Use
__future__.annotationson some internal modules (#2199)
- Support the WebSocket Denial Response ASGI extension (#1916)
- Allow explicit hidden file paths on
--reload-include(#2176) - Properly annotate
uvicorn.run()(#2158)
- Revert mkdocs-material from 9.1.21 to 9.2.6 (#2148)
- Support Python 3.12 (#2145)
- Allow setting
appvia environment variableUVICORN_APP(#2106)
- Maintain the same behavior of
websocketsfrom 10.4 on 11.0 (#2061)
- Add
typing_extensionsfor Python 3.10 and lower (#2053)
- Add
--ws-max-queueparameter WebSockets (#2033)
- Drop support for Python 3.7 (#1996)
- Remove
asgirefas typing dependency (#1999)
- Set
scope["scheme"]towsorwssinstead ofhttporhttpsonProxyHeadersMiddlewarefor WebSockets (#2043)
- Raise
ImportErroron circular import (#2040) - Use
logger.getEffectiveLevel()instead oflogger.levelto check if log level isTRACE(#1966)
- Add
--timeout-graceful-shutdownparameter (#1950) - Handle
SIGBREAKon Windows (#1909)
- Shutdown event is now being triggered on Windows when using hot reload (#1584)
--reload-delayis effectively used on thewatchfilesreloader (#1930)
- Reset lifespan state on each request (#1903)
- Introduce lifespan state (#1818)
- Allow headers to be sent as iterables on H11 implementation (#1782)
- Improve discoverability when --port=0 is used (#1890)
- Avoid importing
h11andpyyamlwhen not needed to improve import time (#1846) - Replace current native
WSGIMiddlewareimplementation bya2wsgi(#1825) - Change default
--app-dirfrom "." (dot) to "" (empty string) (#1835)
- Send code 1012 on shutdown for WebSockets (#1816)
- Use
surrogateescapeto encode headers onwebsocketsimplementation (#1005) - Fix warning message on reload failure (#1784)
- Check if handshake is completed before sending frame on
wsprotoshutdown (#1737) - Add default headers to WebSockets implementations (#1606 & #1747)
- Warn user when
reloadandworkersflag are used together (#1731)
- Use correct
WebSocketerror codes onclose(#1753) - Send disconnect event on connection lost for
wsproto(#996) - Add
SIGQUIThandler toUvicornWorker(#1710) - Fix crash on exist with "--uds" if socket doesn't exist (#1725)
- Annotate
CONFIG_KWARGSinUvicornWorkerclass (#1746)
- Remove conditional on
RemoteProtocolError.event_hintonwsproto(#1486) - Remove unused
handle_no_connectonwsprotoimplementation (#1759)
- Support Python 3.11 (#1652)
- Bump minimal
httptoolsversion to0.5.0(#1645) - Ignore HTTP/2 upgrade and optionally ignore WebSocket upgrade (#1661)
- Add
py.typedto comply with PEP 561 (#1687)
- Set
propagatetoFalseon "uvicorn" logger (#1288) - USR1 signal is now handled correctly on
UvicornWorker. (#1565) - Use path with query string on
WebSocketslogs (#1385) - Fix behavior on which "Date" headers were not updated on the same connection (#1706)
- Remove the
--debugflag (#1640) - Remove the
DebugMiddleware(#1697)
- Remove cyclic references on HTTP implementations. (#1604)
reload_delaydefault changed fromNoneto0.25onuvicorn.run()andConfig.Noneis not an acceptable value anymore. (#1545)
- Add default
log_configonuvicorn.run()(#1541) - Revert
loggingfile name modification (#1543)
- Use
DEFAULT_MAX_INCOMPLETE_EVENT_SIZEas default toh11_max_incomplete_event_sizeon the CLI (#1534)
- The
reloadflag prioritizeswatchfilesinstead of the deprecatedwatchgod(#1437) - Annotate
uvicorn.run()function (#1423) - Allow configuring
max_incomplete_event_sizeforh11implementation (#1514)
- Remove
asgirefdependency (#1532)
- Turn
raw_pathinto bytes on both websockets implementations (#1487) - Revert log exception traceback in case of invalid HTTP request (#1518)
- Set
asyncio.WindowsSelectorEventLoopPolicy()when using multiple workers to avoid "WinError 87" (#1454)
- Change
httptoolsrange to>=0.4.0(#1400)
- Fix case where url is fragmented in httptools protocol (#1263)
- Fix WSGI middleware not to explode quadratically in the case of a larger body (#1329)
- Send HTTP 400 response for invalid request (#1352)
- Replace
create_serverbycreate_unix_server(#1362)
- Drop wsproto version checking. (#1359)
- Revert #1332. While trying to solve the memory leak, it introduced an issue (#1345) when the server receives big chunks of data using the
httptoolsimplementation. (#1354) - Revert stream interface changes. This was introduced on 0.14.0, and caused an issue (#1226), which caused a memory leak when sending TCP pings. (#1355)
- Fix wsproto version check expression (#1342)
- Move all data handling logic to protocol and ensure connection is closed. (#1332)
- Change
spec_versionfield from "2.1" to "2.3", as Uvicorn is compliant with that version of the ASGI specifications. (#1337)
- Add the
python_requiresversion specifier (#1328)
- Allow configurable websocket per-message-deflate setting (#1300)
- Support extra_headers for WS accept message (#1293)
- Add missing http version on websockets scope (#1309)
- Drop Python 3.6 support (#1261)
- Fix reload process behavior when exception is raised (#1313)
- Remove
root_pathfrom logs (#1294)
- Enable read of uvicorn settings from environment variables (#1279)
- Bump
websocketsto 10.0. (#1180) - Ensure non-zero exit code when startup fails (#1278)
- Increase
httptoolsversion range from "==0.2.*" to ">=0.2.0,<0.4.0". (#1243) - Override default asyncio event loop with reload only on Windows (#1257)
- Replace
HttpToolsProtocol.pipelinetype fromlisttodeque. (#1213) - Replace
WSGIResponder.send_queuetype fromlisttodeque. (#1214)
- Main process exit after startup failure on reloader classes (#1177)
- Fix the need of
httptoolson minimal installation (#1135) - Fix ping parameters annotation in Config class (#1127)
- Change reload to be configurable with glob patterns. Currently only
.pyfiles are watched, which is different from the previous default behavior. (#820) - Add Python 3.10-rc.1 support. Now the server uses
asyncio.runwhich will: start a fresh asyncio event loop, on shutdown cancel any background tasks rather than aborting them,aexitany remaining async generators, and shutdown the defaultThreadPoolExecutor. (#1070) - Exit with status 3 when worker starts failed (#1077)
- Add option to set websocket ping interval and timeout (#1048)
- Adapt bind_socket to make it usable with multiple processes (#1009)
- Add existence check to the reload directory(ies) (#1089)
- Add missing trace log for websocket protocols (#1083)
- Support disabling default Server and Date headers (#818)
- Add PEP440 compliant version of click (#1099)
- Bump asgiref to 3.4.0 (#1100)
- When receiving a
SIGTERMsupervisors now terminate their processes before joining them (#1069) - Fix
httptoolsrange to>=0.4.0(#1400)
- Defaults ws max_size on server to 16MB (#995)
- Improve user feedback if no ws library installed (#926 and #1023)
- Support 'reason' field in 'websocket.close' messages (#957)
- Implemented lifespan.shutdown.failed (#755)
- Upgraded websockets requirements (#1065)
- Switch to asyncio streams API (#869)
- Update httptools from 0.1.* to 0.2.* (#1024)
- Allow Click 8.0, refs #1016 (#1042)
- Add search for a trusted host in ProxyHeadersMiddleware (#591)
- Up wsproto to 1.0.0 (#892)
- Force reload_dirs to be a list (#978)
- Fix gunicorn worker not running if extras not installed (#901)
- Fix socket port 0 (#975)
- Prevent garbage collection of main lifespan task (#972)
- Fixed wsgi middleware PATH_INFO encoding (#962)
- Fixed uvloop dependency (#952) then (#959)
- Relax watchgod up bound (#946)
- Return 'connection: close' header in response (#721)
- Docs: Nginx + websockets (#948)
- Document the default value of 1 for workers (#940) (#943)
- Enabled permessage-deflate extension in websockets (#764)
- Prevent swallowing of return codes from
subprocesswhen running with Gunicorn by properly resetting signals. (#895) - Tweak detection of app factories to be more robust. A warning is now logged when passing a factory without the
--factoryflag. (#914) - Properly clean tasks when handshake is aborted when running with
--ws websockets. (#921)
- Log full exception traceback in case of invalid HTTP request. (#886 and #888)
- Prevent exceptions when the ASGI application rejects a connection during the WebSocket handshake, when running on both
--ws wsprotoor--ws websockets. (#704 and #881) - Ensure connection
scopedoesn't leak in logs when using JSON log formatters. (#859 and #884)
- Add
--factoryflag to support factory-style application imports. (#875) - Skip installation of signal handlers when not in the main thread. Allows using
Serverin multithreaded contexts without having to override.install_signal_handlers(). (#871)
- Fix race condition that leads Quart to hang with uvicorn (#848)
- Use latin1 when decoding X-Forwarded-* headers (#701)
- Rework IPv6 support (#837)
- Cancel old keepalive-trigger before setting new one. (#832)
- Adding ability to decrypt ssl key file (#808)
- Support .yml log config files (#799)
- Added python 3.9 support (#804)
- Fixes watchgod with common prefixes (#817)
- Fix reload with ipv6 host (#803)
- Added cli support for headers containing colon (#813)
- Sharing socket across workers on windows (#802)
- Note the need to configure trusted "ips" when using unix sockets (#796)
- Pinning h11 and python-dotenv to min versions (#789)
- Get docs/index.md in sync with README.md (#784)
- Improve changelog by pointing out breaking changes (#792)
- Make reload delay configurable (#774)
- Upgrade maximum h11 dependency version to 0.10 (#772)
- Allow .json or .yaml --log-config files (#665)
- Add ASGI dict to the lifespan scope (#754)
- Upgrade wsproto to 0.15.0 (#750)
- Use optional package installs (#666)
- Don't set log level for root logger (#767) 8/28/20 df81b168
- Uvicorn no longer ships extra dependencies
uvloop,websocketsandhttptoolsas default. To install these dependencies useuvicorn[standard].
- Revert "Improve shutdown robustness when using
--reloador multiprocessing (#620)" (#756) - Fix terminate error in windows (#744)
- Fix bug where --log-config disables uvicorn loggers (#512)
- Fix a regression that caused Uvicorn to crash when using
--interface=wsgi. (#730) - Fix a regression that caused Uvicorn to crash when using unix domain sockets. (#729)
- SECURITY FIX: Prevent sending invalid HTTP header names and values. (#725)
- SECURITY FIX: Ensure path value is escaped before logging to the console. (#724)
- Fix
--proxy-headersclient IP and host when using a Unix socket. (#636)
- Fix overriding the root logger.
- Revert "Watch all files, not just .py" due to unexpected side effects.
- Revert "Pass through gunicorn timeout config." due to unexpected side effects.
- Use
watchgod, if installed, for watching code changes. - Watch all files, not just .py.
- Pass through gunicorn timeout config.
- Update dependencies.
- Don't open socket until after application startup.
- Support
--backlog.
- Use a more liberal
h11dependency. Either0.8.*or `0.9.*``.
- Fix reload/multiprocessing on Windows with Python 3.8.
- Drop IOCP support. (Required for fix above.)
- Add
uvicorn --versionflag. - Add
--use-colorsand--no-use-colorsflags. - Display port correctly, when auto port selection isused with
--port=0.
- Fix reload/multiprocessing error.
- Use resource_sharer.DupSocket to resolve socket sharing on Windows.
- Exit if
workersorreloadare use without an app import string style. - Reorganise supervisor processes to properly hand over sockets on windows.
- Update uvloop dependency to 0.14+
- Error clearly when
workers=<NUM>is used with app instance, instead of an app import string. - Switch
--reload-dirto current working directory by default.
- Add ``--log-level trace`
- Enable --proxy-headers by default.
- Resolve issues with logging when using
--reloador--workers. - Setup up root logger to capture output for all logger instances, not just
uvicorn.erroranduvicorn.access.
- Support for Python 3.8
- Separated out
uvicorn.erroranduvicorn.accesslogs. - Coloured log output when connected to a terminal.
- Dropped
logger=config setting. - Added
--log-config [FILE]andlog_config=[str|dict]. May either be a Python logging config dictionary or the file name of a logging configuration. - Added
--forwarded_allow_ipsandforwarded_allow_ips. Defaults to the value of the$FORWARDED_ALLOW_IPSenvironment variable or "127.0.0.1". The--proxy-headersflag now defaults toTrue, but only trusted IPs are used to populate forwarding info. - The
--workerssetting now defaults to the value of the$WEB_CONCURRENCYenvironment variable. - Added support for
--env-file. Requirespython-dotenv.