Benoit Chesneau 9bc5891b4b fix: drop body framing on HEAD/1xx/204/304 in WSGI responses
Mirror the ASGI strip-and-warn behavior (commits 2191832b, 41ec7527,
0d35d2ae) on the WSGI path. Previously gunicorn would forward an
app-supplied Content-Length and body bytes for HEAD requests and
1xx/204/304 responses, violating RFC 9110 / RFC 9112.

- Add _response_omits_body() and _response_forbids_content_length()
  helpers on Response.
- After process_headers, strip Content-Length and clear
  response_length on 1xx/204 (RFC 9110 §6.4.2 forbids it). HEAD and
  304 keep app-supplied Content-Length.
- write() and sendfile() drop body bytes for no-body responses and
  log a single WARNING per request.
- is_chunked() now also covers 1xx via _omits_body.

Fixes #3413
2026-05-05 11:30:24 +02:00
2026-05-05 08:35:19 +02:00
2026-02-06 08:21:18 +01:00
2026-01-23 01:20:03 +01:00
2026-02-06 08:21:18 +01:00
2026-01-27 09:46:42 +01:00
2026-02-06 08:21:18 +01:00
2026-05-05 08:35:19 +02:00
2026-03-24 23:21:23 +01:00

Gunicorn

Gunicorn is maintained by volunteers. If it powers your production, please consider supporting us:
GitHub Sponsors Revolut

PyPI version Supported Python versions Build Status

Gunicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX. It's a pre-fork worker model ported from Ruby's Unicorn project. The Gunicorn server is broadly compatible with various web frameworks, simply implemented, light on server resource usage, and fairly speedy.

New in v25: Per-app worker allocation for dirty arbiters, HTTP/2 support (beta)!

Quick Start

pip install gunicorn
gunicorn myapp:app --workers 4

For ASGI applications (FastAPI, Starlette):

gunicorn myapp:app --worker-class asgi

Features

  • WSGI support for Django, Flask, Pyramid, and any WSGI framework
  • ASGI support for FastAPI, Starlette, Quart
  • HTTP/2 support (beta) with multiplexed streams
  • Dirty Arbiters (beta) for heavy workloads (ML models, long-running tasks)
  • uWSGI binary protocol for nginx integration
  • Multiple worker types: sync, gthread, gevent, asgi
  • Graceful worker process management
  • Compatible with Python 3.9+

Documentation

Full documentation at https://gunicorn.org

Community

Support

Powering Python apps since 2010. Support continued development.

Become a Sponsor

Sponsors

Enki Multimedia

License

Gunicorn is released under the MIT License. See the LICENSE file for details.

Description
gunicorn 'Green Unicorn' is a WSGI HTTP Server for UNIX, fast clients and sleepy applications.
Readme MIT 8.2 MiB
Languages
Python 99.9%