commit 4a0afa9fea60bf2d1943b59a1f4ab49cb89e682a
Author: Samuel Merritt <email address hidden>
Date: Fri Jun 15 16:31:25 2018 -0700
Enforce Content-Length in catch_errors
If a WSGI application produces the header "Content-Length: <N>" but
does not produce exactly N bytes of response, then that is an error
and an exception should be thrown so that the WSGI server can take the
correct action (close the TCP connection for HTTP <= 1.1, something
else for HTTP 2.0).
As part of this, I also fixed a bug in DLOs where a HEAD response
might have a body. The way it works is this:
* user makes HEAD request for DLO manifest
* DLO middleware makes GET request for container
* authorize callback (e.g. from tempurl) replies 401 for container
GET; response has a nonempty body (it's a GET response; that's
fine)
* DLO notes that response is non-2xx, returns it as-is
* client gets response with nonempty body to a HEAD request
The fix there was simple; if the original request method was HEAD,
clear out the response body.
Reviewed: https:/ /review. openstack. org/575876 /git.openstack. org/cgit/ openstack/ swift/commit/ ?id=4a0afa9fea6 0bf2d1943b59a1f 4ab49cb89e682a
Committed: https:/
Submitter: Zuul
Branch: master
commit 4a0afa9fea60bf2 d1943b59a1f4ab4 9cb89e682a
Author: Samuel Merritt <email address hidden>
Date: Fri Jun 15 16:31:25 2018 -0700
Enforce Content-Length in catch_errors
If a WSGI application produces the header "Content-Length: <N>" but
does not produce exactly N bytes of response, then that is an error
and an exception should be thrown so that the WSGI server can take the
correct action (close the TCP connection for HTTP <= 1.1, something
else for HTTP 2.0).
As part of this, I also fixed a bug in DLOs where a HEAD response
might have a body. The way it works is this:
* user makes HEAD request for DLO manifest
* DLO middleware makes GET request for container
* authorize callback (e.g. from tempurl) replies 401 for container
GET; response has a nonempty body (it's a GET response; that's
fine)
* DLO notes that response is non-2xx, returns it as-is
* client gets response with nonempty body to a HEAD request
The fix there was simple; if the original request method was HEAD,
clear out the response body.
Change-Id: I74d8c13eba2a49 17b5a116875b51a 781b33a7abf
Related-Bug: 1568650