http中的payload怎么理解?
48
20,757
4 个回答

知乎用户
payload英语单词意思是有效载荷,在http中,应该是post请求时,所携带的有效数据的意思,比如你post请求上传文件,用谷歌浏览器抓包可以看到payload相关信息,它分成了多组数据描述信息,用类似于“——WebKitFormBoundaryaL7XJASi3bOcnKjn”这样的字符串分割,Content-Disposition: form-data; name=”localUrl”这个是描述上传的文件的本地路径,Content-Disposition: form-data; name=”imgFile”; filename=”1.png”Content-Type: image/png这个是描述上传的图片的mime类型
payload就是协议报文中的有效载荷所占报文的百分比,用报文中去除协议的长度/报文总长度,协议设计的时候需要考虑到有效载荷所占的比重,避免出现payload很小的情况,比如TCP在设计的时候,就考虑在发送报文过程中,增加了接收报文的确认,而不是单独发送一个确认,因为单独发送一个报文的payload太低。
1.
In
computing
and
telecommunications
, the
payload
is the part of
transmitted data
that is the actual intended message. The payload excludes any
headers
or
metadata
sent solely to facilitate payload delivery.
2.
In
computer security
, the payload is the part of
malware
such as
worms
or
viruses
which performs the malicious action; deleting data, sending spam or encrypting data. In addition to the payload, such malware also typically has overhead code aimed at simply spreading itself, or avoiding detection.
3.
In the
computer networking
, data to be transmitted is the payload, but is almost always
encapsulated
in some type of a “frame” composed of
framing bits
and a
frame check sequence
.Examples are
Ethernet frames
,
Point-to-Point Protocol
(PPP) frames,
Fibre Channel frames
, and
V.42 modem frames
.
4.
In
computer programming
, the most common usage of the term is in the context of message protocols, to differentiate the protocol overhead from the actual data. For example, a
JSON
web service
response might be:
{
"data":{
"message":"Hello, world!"
}
}
The string “Hello, world!” is the payload, while the rest is protocol overhead.
On the Internet, a payload is either:
1) The essential data that is being carried within a
packet
or other transmission unit. The payload does not include the “overhead” data required to get the packet to its destination. Note that what constitutes the payload may depend on the point-of-view. To a communications layer that needs some of the overhead data to do its job, the payload is sometimes considered to include the part of the overhead data that this layer handles. However, in more general usage, the payload is the bits that get delivered to the end user at the destination.
2) The eventual effect of a software
virus
that has been delivered to a user’s computer.