107 Commits

Author SHA1 Message Date
Benoit Chesneau
26ae6e6f47 Add ASGI framework compatibility E2E test suite
Docker-based test suite validating gunicorn's ASGI worker against:
- Django + Channels
- FastAPI
- Starlette
- Quart
- Litestar
- BlackSheep

Tests cover HTTP scope, HTTP messages, WebSocket, lifespan protocol,
and streaming responses. Includes compatibility grid generator.

Results: 403/444 tests passed (90%)
2026-04-03 11:10:00 +02:00
Benoit Chesneau
9bce72cfc3 Update changelog with missing 25.3.0 changes 2026-03-27 00:45:56 +01:00
Benoit Chesneau
bdb2ebd5a4 Reject chunk extensions with bare CR bytes (RFC 9112)
Both WSGI and ASGI parsers now validate that chunk extensions
do not contain bare CR characters, which are not allowed per
RFC 9112.

Fixes #3556
2026-03-26 15:45:48 +01:00
Benoit Chesneau
7057fc9f89 Fix http_protocols documentation to use string syntax
The http_protocols setting expects a comma-separated string, not a list.
Updated all examples in the HTTP/2 guide.

Fixes #3561
2026-03-26 15:45:11 +01:00
Benoit Chesneau
d43acb8fe0 Update to gunicorn_h1c >= 0.6.2 for asgi_headers support
- Use asgi_headers property (lowercase names) from fast parser
- Bump version to 25.3.0
- Update changelog with all changes for this release
2026-03-26 15:45:11 +01:00
Benoit Chesneau
389438fb5a Require gunicorn_h1c >= 0.6.0 for finish() method support
Update minimum version requirement for the fast HTTP parser to 0.6.0
which includes the finish() method for EOF handling in chunked encoding.
2026-03-26 14:12:50 +01:00
Benoit Chesneau
5d9f865c59 Update sponsorship: remove Open Collective, add Enki Multimedia
- Remove Open Collective links from README, sponsor page, and FUNDING.yml
- Update Revolut donation link
- Add Enki Multimedia as sponsor on homepage, sponsor page, and README
2026-03-25 14:16:12 +01:00
Benoit Chesneau
18f5d0ea95 Fix 25.2.0 changelog: correct ASGI parser optimization description
Remove inaccurate BytesIO claims - the callback parser uses bytearray directly.
2026-03-25 09:42:07 +01:00
Benoit Chesneau
dcaf2e14a5 Add 25.2.0 to 2026 changelog 2026-03-24 23:44:09 +01:00
Benoit Chesneau
6f601a0de9 Bump version to 25.2.0 2026-03-24 23:42:01 +01:00
Benoit Chesneau
cb708b4698 Add uwsgi async fix to changelog 2026-03-24 23:18:25 +01:00
Benoit Chesneau
f555180191 Add FileWrapper iterator fix to changelog 2026-03-24 23:06:06 +01:00
Benoit Chesneau
0ad47db800
Use user-writable default path for control socket (#3551)
The previous default /run/gunicorn.ctl requires root permissions.
Now uses $XDG_RUNTIME_DIR/gunicorn.ctl if available, otherwise
$HOME/.gunicorn/gunicorn.ctl. This works on Linux, FreeBSD, OpenBSD,
and macOS without requiring elevated privileges.

- Add _get_default_control_socket() helper in config.py
- Create parent directory automatically with 0o700 permissions
- Update gunicornc CLI to use the same default path
- Add unit tests for path selection and directory creation
2026-03-23 20:08:03 +01:00
Benoit Chesneau
ae776cf25c Add ASGI performance documentation 2026-03-22 17:14:49 +01:00
Benoit Chesneau
932331d8a4 Regenerate settings.md 2026-03-22 16:23:46 +01:00
Benoit Chesneau
2bf2632944 Update docs and changelog for gunicorn_h1c 0.4.1 integration 2026-03-22 13:44:31 +01:00
Benoit Chesneau
8ad49b8df3 Update settings.md for simplified http_parser options 2026-03-22 08:09:35 +01:00
Benoit Chesneau
fa967743c0 Optimize ASGI performance with fast parser integration
Wire HttpParser to ASGI hot path, replacing AsyncRequest.parse() with
direct buffer-based parsing. Add FastAsyncRequest wrapper for body
reading. Replace per-request Queue/Task with BodyReceiver for on-demand
body reading. Keep headers as bytes end-to-end to avoid conversion
overhead. Add backpressure control and keepalive timer. Cache response
status lines and Date header.

Benchmark shows 3x improvement: ~875K req/s for simple GET (was ~340K).
2026-03-21 11:36:46 +01:00
Benoit Chesneau
8caf79ec64
Merge pull request #3494 from Juneezee/docs/forwarded_allow_ips
docs: update forwarded_allow_ips to Markdown
2026-03-09 13:35:57 +01:00
Benoit Chesneau
24e7ced609
Merge pull request #3520 from benoitc/fix/control-socket-issues
fix(ctl): prevent fork deadlock and file watcher triggers
2026-03-06 23:58:57 +01:00
Benoit Chesneau
7499da9a17 docs: regenerate settings.md for control_socket default 2026-02-27 15:16:40 +01:00
Benoit Chesneau
b3b98b1322 perf(asgi): optimize HTTP parser for improved performance
- Read chunk size lines and trailers in 64-byte blocks instead of 1 byte
  at a time, pushing back excess data to the unreader buffer
- Reuse BytesIO buffers with truncate/seek instead of creating new
  objects to reduce GC pressure in AsyncUnreader
- Use bytearray.find() directly instead of converting to bytes first
  in header parsing loop
- Use index-based iteration for header parsing instead of list.pop(0)
  which is O(n) per pop vs O(1) for index access

Add tests for the optimized parsing code paths.
2026-02-18 10:00:46 +01:00
Benoit Chesneau
2d4310116d docs: merge gunicornc into 25.1.0 release 2026-02-13 12:03:48 +01:00
Benoit Chesneau
bf4ad8d610 docs: update 25.1.0 release date to 2026-02-13 2026-02-13 11:59:42 +01:00
Benoit Chesneau
3e60d2942d docs: add gunicornc control interface guide
- Add guides/gunicornc.md with usage examples and command reference
- Update mkdocs.yml navigation to include Control Interface guide
- Update 2026-news.md and news.md changelog with 25.2.0 release
- Regenerate reference/settings.md with control socket settings
2026-02-13 02:29:44 +01:00
Benoit Chesneau
0077b05916 docs: add TTIN/TTOU to changelog 2026-02-12 23:59:20 +01:00
Benoit Chesneau
2639215aa3 feat(dirty): add TTIN/TTOU signal support for dynamic worker scaling
Add support for SIGTTIN and SIGTTOU signals to the dirty arbiter,
allowing dynamic scaling of dirty workers at runtime without restarting
gunicorn.

Changes:
- Add TTIN/TTOU to DirtyArbiter.SIGNALS
- Add num_workers instance variable for dynamic count
- Add _get_minimum_workers() to enforce app worker constraints
- Add signal handlers for TTIN (increase) and TTOU (decrease)
- Update manage_workers() to use dynamic count
- Add documentation for dynamic scaling
- Add unit tests for signal handling
- Add Docker integration tests

The minimum worker constraint ensures TTOU cannot reduce workers below
what apps require (e.g., if an app has workers=3, minimum is 3).

Closes #3489
2026-02-12 23:52:12 +01:00
Benoit Chesneau
ac00c862d7 docs: mark ASGI as stable, Dirty Arbiters as beta
- Remove beta warning from ASGI worker documentation
- Add beta warning to Dirty Arbiters documentation
- Update README feature list accordingly
- Update changelog to reflect stability changes
2026-02-12 22:09:14 +01:00
Benoit Chesneau
7f6cf908e5 release: 25.1.0
New Features:
- Dirty Stash: global shared state between workers (#3503)
- Dirty Binary Protocol: TLV encoding for efficient IPC (#3500)

Documentation:
- Fix Markdown formatting in /configure
2026-02-12 22:06:44 +01:00
Benoit Chesneau
709a6ad159
feat(dirty): add stash - global shared state between workers (#3503)
* feat(dirty): add stash - global shared state between workers

Add a simple key-value store (stash) that allows dirty workers to share
state through the arbiter. Tables are stored directly in arbiter memory
for fast access and simplicity.

Features:
- Auto-create tables on first access
- Dict-like interface via stash.table()
- Pattern matching for keys (glob patterns)
- Module-level API: stash.put(), stash.get(), stash.delete(), etc.

Usage:
    from gunicorn.dirty import stash

    stash.put("sessions", "user:1", {"name": "Alice"})
    user = stash.get("sessions", "user:1")

    # Or dict-like
    sessions = stash.table("sessions")
    sessions["user:1"] = {"name": "Alice"}

New files:
- gunicorn/dirty/stash.py - Client API and StashTable class
- Protocol additions for MSG_TYPE_STASH and STASH_OP_* codes

Note: Tables are ephemeral - lost if arbiter restarts.

* test(dirty): add tests for stash protocol and encoding

Test coverage for:
- Stash message creation and encoding
- Protocol constants (MSG_TYPE_STASH, STASH_OP_*)
- Error classes (StashError, StashTableNotFoundError, StashKeyNotFoundError)
- StashTable dict-like interface
- Edge cases: unicode, complex values, special patterns

* example(dirty): add stash usage example and integration tests

- Add SessionApp to dirty_app.py demonstrating stash usage
- Add /session/* endpoints to wsgi_app.py
- Add test_stash_integration.py with Docker tests
- Update docker-compose.yml with stash-test service
- Fix: Set GUNICORN_DIRTY_SOCKET in dirty arbiter for worker access

* docs(dirty): add stash documentation
2026-02-12 21:45:49 +01:00
Benoit Chesneau
236c9371d0
Merge pull request #3502 from Juneezee/docs/issues-3498
docs: fix Markdown formatting in /configure
2026-02-12 17:52:07 +01:00
Eng Zer Jun
1cd4db8ddf
docs: fix Markdown formatting in /configure
Fixes https://github.com/benoitc/gunicorn/issues/3498.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2026-02-12 21:12:24 +08:00
Benoit Chesneau
00da70292f docs(dirty): update examples and docs for binary protocol
- Update test_protocol.py example to use binary protocol
- Add test_binary_data_handling example showing raw bytes transfer
- Update dirty.md to document binary TLV protocol format
- Replace JSON references with binary protocol
- Add Binary Protocol section with header and TLV encoding details
2026-02-11 23:15:14 +01:00
Eng Zer Jun
c0959609ef
Use markdown-grid-tables for multiline table
pycodestyle enforces 120-character line lengtn limit.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2026-02-12 00:25:29 +08:00
Eng Zer Jun
fb698ef0f7
docs: update forwarded_allow_ips to Markdown
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2026-02-10 12:32:23 +08:00
Benoit Chesneau
fc850687df chore: prepare release 25.0.3 2026-02-07 15:36:43 +01:00
Benoit Chesneau
874e8be0a1 docs: shorten sponsor section on homepage
Simplify the sponsor section to a single concise line and link to
the dedicated sponsor page instead of GitHub sponsors directly.
2026-02-07 11:31:40 +01:00
Benoit Chesneau
7293b216f4 docs: add prominent sponsorship options
- Add sponsor banner at top of README
- Add Revolut and Open Collective to FUNDING.yml
- Add dedicated sponsor page in docs
- Add sponsor heart link in footer
2026-02-07 11:29:15 +01:00
Benoit Chesneau
70d571bd7c docs: update homepage title and remove version display
- Change title from "The Python WSGI Server" to "Serve Python Apps on the Web"
- Remove "Version {{ version }}" text from hero section
- Remove unused .hero__version CSS
2026-02-07 11:08:04 +01:00
Benoit Chesneau
95b7ffeeaa chore: prepare release 25.0.2
- Bump version to 25.0.2
- Update copyright year to 2026 in LICENSE and NOTICE
- Add license headers to all Python source files
- Add changelog entry for 25.0.2
2026-02-06 08:21:18 +01:00
Benoit Chesneau
3bf718ea52 fix: graceful disconnect handling for ASGI worker
Closes #3484

When a client disconnects during an ASGI request, the worker now:
1. Sends http.disconnect message to the app's receive queue
2. Allows a configurable grace period for cleanup (default: 3 seconds)
3. Only cancels the task after the grace period expires

This follows the ASGI HTTP Connection Scope spec which defines
http.disconnect as the message apps should receive when clients
disconnect: https://asgi.readthedocs.io/en/latest/specs/www.html#disconnect-receive-event

The grace period prevents CancelledError from propagating to async
database operations, allowing SQLAlchemy and other async DB libraries
to properly reset their connection pools.

New config option: --asgi-disconnect-grace-period (default: 3 seconds)
2026-02-03 02:46:07 +01:00
Benoit Chesneau
3373e4b987 docs: add CNAME file for custom domain 2026-02-02 23:36:30 +01:00
Benoit Chesneau
a7e14e16fd docs: replace sponsors section with expanded support section
Update README.md and docs homepage with detailed support messaging
including sponsorship benefits and corporate contact information.
2026-02-02 21:49:15 +01:00
Benoit Chesneau
3bf529f6c2 docs: sync news.md with 2026-news.md 2026-02-02 14:28:37 +01:00
Benoit Chesneau
e1519c0569 docs: add ASGI compliance test suite to changelog 2026-02-02 14:11:22 +01:00
Benoit Chesneau
658924c436 docs: update changelog for 25.0.1 2026-02-02 10:17:50 +01:00
Benoit Chesneau
9ece4a6873 docs: add GitHub icon to header, remove header.autohide 2026-02-01 15:04:41 +01:00
Benoit Chesneau
8652aec783 docs: update news.md with complete 25.0.0 changelog 2026-02-01 14:50:02 +01:00
Benoit Chesneau
d621aa81f9 fix: add version number to homepage hero section 2026-02-01 14:47:48 +01:00
Benoit Chesneau
617a85ea91 docs: update 25.0.0 release date to 2026-02-01 2026-02-01 14:30:56 +01:00