T56938 is a missing content-length header in a request between netrender client and master.
T54222 is the same for a request between slave and master.
Further details can be found there.
The fix introduces a new function, sendFile, which PUTs a file to a specified URL, and it uses the function in several places. That is, duplicates of the code I fixed are fixed as well (and removed).
I am not sure whether this is the best possible fix, after all, the python http.client library does have functionality to set this header automatically. It is just that this functionality is not enabled in our use case. If there is a way to enable it, this would be preferable.
Also, I only tested this on Linux Fedora 28, so other operating systems may show different behaviour.