Skip to content

204/304 responses should not send body or Content-Length (RFC 9112 compliance) #3413

@JaeHyuckSa

Description

@JaeHyuckSa

Currently, Gunicorn forwards 204 and 304 responses even when the app includes a non-zero Content-Length or a body.

According to RFC 9112 , these responses must not include a message body, and Content-Length must be absent or zero.

Expected behavior

For 1xx, 204, 304 responses (and HEAD requests):

  • Any response body should be ignored or dropped.
  • Content-Length should be removed.

Actual behavior

Gunicorn sends the body and headers as provided by the WSGI app, even when they violate the spec.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions