这是什么意思?

头中指定编码的已编码内容字符串的字节数。 内容字符串的字符数。

特别是在Content-Type: application/x-www-form-urlencoded的情况下。


当前回答

根据说明书:

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. Content-Length = "Content-Length" ":" 1*DIGIT An example is Content-Length: 3495 Applications SHOULD use this field to indicate the transfer-length of the message-body, unless this is prohibited by the rules in section 4.4. Any Content-Length greater than or equal to zero is a valid value. Section 4.4 describes how to determine the length of a message-body if a Content-Length is not given. Note that the meaning of this field is significantly different from the corresponding definition in MIME, where it is an optional field used within the "message/external-body" content-type. In HTTP, it SHOULD be sent whenever the message's length can be determined prior to being transferred, unless this is prohibited by the rules in section 4.4.

其他回答

一个八位是8位。Content-length是消息体所代表的字节数。

rfc2616

的Content-Length实体报头字段表示 entity-body,十进制形式的OCTETs,发送给接收方 HEAD方法的情况,entity-body的大小 如果请求是GET,则已经发送了。

内容类型是什么并不重要。

延长线在以下职位。

Content-Length entity-header字段表示发送给接收者的实体体的大小,以OCTETs的十进制数表示,或者在HEAD方法的情况下,表示如果请求是GET,将发送的实体体的大小。

Content-Length = "Content-Length" ":" 1*DIGIT .

一个例子是

内容长度:1024

应用程序应该使用这个字段来指示消息体的传输长度。

在PHP中,你会使用这样的东西。

header("Content-Length: ".filesize($filename));

在“Content-Type: application/x-www-form-urlencoded”的情况下,编码后的数据被发送到指定的处理代理,以便您可以设置将要发布的数据的长度或大小。

根据说明书:

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. Content-Length = "Content-Length" ":" 1*DIGIT An example is Content-Length: 3495 Applications SHOULD use this field to indicate the transfer-length of the message-body, unless this is prohibited by the rules in section 4.4. Any Content-Length greater than or equal to zero is a valid value. Section 4.4 describes how to determine the length of a message-body if a Content-Length is not given. Note that the meaning of this field is significantly different from the corresponding definition in MIME, where it is an optional field used within the "message/external-body" content-type. In HTTP, it SHOULD be sent whenever the message's length can be determined prior to being transferred, unless this is prohibited by the rules in section 4.4.

从本页

The most common use of POST, by far, is to submit HTML form data to CGI scripts. In this case, the Content-Type: header is usually application/x-www-form-urlencoded, and the Content-Length: header gives the length of the URL-encoded form data (here's a note on URL-encoding). The CGI script receives the message body through STDIN, and decodes it. Here's a typical form submission, using POST: POST /path/script.cgi HTTP/1.0 From: frog@jmarshall.com User-Agent: HTTPTool/1.0 Content-Type: application/x-www-form-urlencoded Content-Length: 32