Pylons / waitress

Waitress - A WSGI server for Python 3
https://docs.pylonsproject.org/projects/waitress/en/latest/
Other
1.44k stars 164 forks source link

Avoid closing connections when `HEAD` requests have a content length #428

Closed zanieb closed 7 months ago

zanieb commented 8 months ago

Closes https://github.com/Pylons/waitress/issues/427

When a WSGI application does not return sufficient content to satisfy the attached Content-Length header, the connection is closed to prevent the client from needlessly waiting. However, HTTP HEAD requests can set a Content-Length header without any content in the body. #7 removed a warning that was incorrectly displayed when this occurs, but the connection was still being closed. As demonstrated in #427, this abrupt close can cause client-side failures. Here, the connection is no longer closed for HEAD requests with Content-Length set, which resolves the linked issue.

zanieb commented 7 months ago

The lint failure here is entirely unrelated to this pull request, it looks like black needs to be run on main?