Werk #12679: cmk-update-agent: Prevent crash on missing "Content-Length" HTTP header

Component Agent bakery
Title cmk-update-agent: Prevent crash on missing "Content-Length" HTTP header
Date Jun 7, 2021
Level Trivial Change
Class Bug Fix
Compatibility Incompatible - Manual interaction might be required
Checkmk versions & editions
2.1.0b1 Checkmk Enterprise (CEE), Checkmk MSP (CME)
2.0.0p6 Checkmk Enterprise (CEE), Checkmk MSP (CME)

Previously, the agent updater expected a "Content-Length" HTTP header in responses from the Checkmk server, and crashed with error message
KeyError: 'content-length'
if it was missing. However, the missing header only occurs in special scenarios, when the agent updater doesn't communicate with the Checkmk server directly, e.g., when having a (reverse) proxy in between.

This is fixed now.

This werk is marked as incompatible, because manual interaction might be needed to overcome the error on a host. You can either install the newly baked agent manually on affected hosts, or prevent the cause that leads to the missing "Content-Length" header: An observed cause for the missing header can be an activated transport compression at some point in the infrastructure between Checkmk server and host. To prevent this, you can add the line
SetEnv no-gzip dont-vary
at the top of the config file /etc/apache2/conf-enabled/zzz_omd.conf on the server running Checkmk, and reload the system apache with systemctl reload apache.

To the list of all Werks