What does it mean?
Especially in case of Content-Type: application/x-www-form-urlencoded
.
The Content-Length header is a number denoting an the exact byte length of the HTTP body. The HTTP body starts immediately after the first empty line that is found after the start-line and headers.
HTTP Content-Length entity-header is used to indicate the size of entity-body in decimal no of octets i.e. bytes and sent it to the recipient. It is a forbidden header name. Basically it is the number of bytes of data in the body of the request or response. The body comes after the blank line below the headers.
The Content-Type representation header is used to indicate the original media type of the resource (prior to any content encoding applied for sending). In responses, a Content-Type header provides the client with the actual content type of the returned content.
<? php print_r($_POST) ; ?>
It's the number of bytes of data in the body of the request or response. The body is the part that comes after the blank line below the headers.
rfc2616
The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET.
It doesn't matter what the content-type is.
Extension at post below.
The Content-Length
header is a number denoting an the exact byte length of the HTTP body. The HTTP body starts immediately after the first empty line that is found after the start-line and headers.
Generally the Content-Length
header is used for HTTP 1.1 so that the receiving party knows when the current response* has finished, so the connection can be reused for another request.
* ...or request, in the case of request methods that have a body, such as POST, PUT or PATCH
Alternatively, Content-Length
header can be omitted and a chunked Transfer-Encoding
header can be used.
If both Content-Length
and Transfer-Encoding
headers are missing, then at the end of the response the connection must be closed.
The following resource is a guide that I found very useful when learning about HTTP:
HTTP Made Really Easy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With