This is an archive of the discontinued Mercurial Phabricator instance.

hgweb: refactor 304 handling code
ClosedPublic

Authored by indygreg on Mar 11 2018, 12:24 AM.

Details

Summary

We had generic code in wsgirequest for handling HTTP 304 responses.
We also had a special case for it in the catch all exception handler
in the WSGI application.

We only ever raise 304 in one place. So, we don't need to treat it
specially in the catch all exception handler.

But it is useful to validate behavior of 304 responses. We port the
code that sends a 304 to use the new response API. We then move the
code for screening 304 sanity into the new response API.

As part of doing so, we discovered that we would send
Content-Length: 0. This is not allowed. So, we fix our response code
to not emit that header for empty response bodies.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Mar 11 2018, 12:24 AM
durin42 accepted this revision.Mar 12 2018, 5:14 PM
This revision is now accepted and ready to land.Mar 12 2018, 5:14 PM
This revision was automatically updated to reflect the committed changes.