Hi Guys,

On Wed, Mar 27, 2019 at 04:28:37PM +0100, Christopher Faulet wrote:
> After checking the haproxy output that you sent me, the error happens
> because the content-length header is skipped when the request is sent to the
> server. It is skipped because the POST is empty, so it is set to 0. Your
> server seems to reject empty POST request when there is no content-length
> header.

Hehe I'm pleased to see I'm not the only one being caught by this one from
time to time. That's why I often say there is a big difference between
"no body" and "empty body". It may be the same for the application at the
end of the chain but in the middle it is not.

> It is not strictly mandatory to have this header in such case but
> there is no reason to skip it.

Not really because POST expects a body, and if you don't announce a
content-length nor chunked encoding, only the close method remains,
which by definition is not really workable. That's why RFC7230 has
clarified this situation this way (#3.3.2) :

   A user agent SHOULD send a Content-Length in a request message when
   no Transfer-Encoding is sent and the request method defines a meaning
   for an enclosed payload body.  For example, a Content-Length header
   field is normally sent in a POST request even when the value is 0
   (indicating an empty payload body). 

Anyway we'll continue to get caught by this one from time to time...

Marco, I've just merged Christopher's patch and backported it to 1.9
so if you want to test again, either you pull from git or you wait
tomorrow for the next snapshot (or maybe even a release).

Thanks,
Willy

Reply via email to