I am receiving a 411 length required error when sending HTTP2 POST requests without a body to an Azure API Management (but this is not a question about Azure). my request is:
curl --location --request POST "..." --header "Content-Type: application/json" --verbose --http2
I'm getting the following logs from curl:
...
Using HTTP2, server supports multi-use
...
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 411
< content-type: text/html; charset=us-ascii
...
< content-length: 344
<
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Length Required</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
I thought this was not necessary for HTTP2, and tried reading what the HTTP2 RFC says about it, but found it confusing:
A request or response that includes a payload body can include a content-length header field.
But what about requests that don't have a body?
Who is correct here, the client who does not send the header, or the server who does not accept the request?