ironic-inspector/ironic_inspector
Julia Kreger 83d15fe15f Return a content-length on HTTP204 to prevent client failures
It turns out that eventlet has been injecting a
``Transfer-Encoding`` header as of recent into WSGI application
response headers. The result of this ultimately depends on how
the HTTP client which is passing the request to the server is
written to handle data.

Apache, for example, will return that an invalid response was
received. In part because it sees the request end, with an HTTP
204 response code, but also an encoding indicating there is
a multipart body encoding inbound. Which is confusing.

Other C based HTTP clients can have any number of reactions up to
and including disconnecting sessions. Curl, depending on the
headers present either returns success but notes body weirdness
or actually returns return code 18.

Python-Requests kind of has it a little worse, and we see this
with clients. With it, it tries to prepare a respones content
body based upon the presence of the header indicating there is
a body. But it blows up thinking there is more data to read on
the socket when there is not more data to read.

Regardless, all of this is an RFC7230 violation.

Neither Content-Length nor Transfer-Encoding should be on an HTTP
204 response. However, Content-Length is the lesser evil, and we
have a similar endpoing in Ironic which *does* explicitly get
returned with a zero length content-length, and does not
demonstrate such issues.

As such, in the interest of the lesser evils until Eventlet's evil
ways of header injection are remedied, we're explicitly going to
force a Content-Length header to be sent indicating a zero length
response.

For more information, please see: https://github.com/eventlet/eventlet/issues/746

Change-Id: I014cc65c79222f4d4d7c2b6ff11a76e56659340c
(cherry picked from commit 55e47c630b)
2022-01-14 20:00:28 +00:00
..
cmd Add upgrade check, and json2yaml policy handling 2021-01-04 13:56:28 -08:00
common Use correct Node id attribute 2020-11-23 16:19:35 +13:00
conductor Add leader election for periodic sync with ironic 2020-07-02 12:17:28 +02:00
conf Add optional healthcheck middleware 2021-09-12 22:51:38 +09:00
locale/en_GB/LC_MESSAGES Imported Translations from Zanata 2020-10-11 06:44:24 +00:00
migrations Fix database migrations and disable the non-standalone job 2020-10-26 14:16:34 +01:00
plugins Trivial: better guard against malformed data in extra_hardware 2021-05-03 15:41:40 +02:00
pxe_filter Do not reset FSM when ironic ports cant be queried 2021-06-14 17:14:54 +03:00
test Return a content-length on HTTP204 to prevent client failures 2022-01-14 20:00:28 +00:00
__init__.py Switch to pbr 2015-06-18 16:09:07 +02:00
alembic.ini Add alembic migrations for the inspector database 2015-09-23 14:44:46 +01:00
api_tools.py Stop using six library 2019-12-17 09:23:01 +01:00
db.py Added scope to introspection rules. 2020-03-26 21:40:43 +01:00
introspect.py Handle NodeLocked failures 2021-08-10 21:15:53 +00:00
introspection_state.py Fix pycodestyle warnings/errors now visible with hacking 1.1.0 2018-05-08 23:46:05 +02:00
known_accelerators.yaml Add NVIDIA V100 to known accelerator devices 2020-09-14 09:54:28 +02:00
main.py Return a content-length on HTTP204 to prevent client failures 2022-01-14 20:00:28 +00:00
node_cache.py Merge "Handle NodeLocked failures" 2021-08-11 00:58:32 +00:00
policy.py Fix & suppress oslo policy warnings 2021-07-05 09:00:06 -05:00
process.py Use openstacksdk for ironic module 2020-03-23 14:28:09 +01:00
rules.py Log outcome of `check_conditions` method. 2020-08-11 14:34:10 +02:00
utils.py Add optional healthcheck middleware 2021-09-12 22:51:38 +09:00
version.py Use Reno for release notes management 2015-11-26 10:12:14 +01:00
wsgi_service.py Split API and conductor services 2019-08-12 15:29:55 +08:00