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-02-06 08:21:18 +01:00
2026-02-06 08:21:18 +01:00
2024-04-22 03:33:30 +02:00
2026-01-27 09:57:32 +01:00
2026-01-27 09:57:32 +01:00
2026-02-06 08:21:18 +01:00
2026-02-06 08:21:18 +01:00
2024-04-22 03:33:14 +02:00
2024-04-22 03:33:14 +02:00
2026-02-06 08:21:18 +01:00
2024-04-22 03:33:14 +02:00