The protocol header and the protocol body are separated by "\r\n\r\n"
The content of the protocol body is obtained by the length of the Content-length
The attachment is uploaded as follows
Post/logsys/home/uploadispeedlog!dodefault.html http/1.1
Accept:text/plain, */*
Accept-language:zh-cn
host:192.168.24.56
content-type:multipart/form-data;boundary=-----------------------------7db372eb000e2
User-agent:winhttpclient
content-length:3693
Connection:keep-alive
-------------------------------7db372eb000e2
Content-disposition:form-data; Name= "File"; Filename= "Kn.jpg"
Content-type:image/jpeg
(Omit JPEG file binary data here ...) )
-------------------------------7db372eb000e2--
The red font part is the head of the protocol, where Content-type is a must, and it includes a flag of a similar character named boundary, which can be a random input string.
content-length:3693, 3693 Here is the total length of the file to be uploaded. If set transfer-encoding:chunked can not be set content-length
The green font part is the data that needs to be uploaded, can be text, it can be pictures and so on. Content-disposition, Content-type, and content-transfer-encoding are required in front of the data content.
The final purple part is the end of the protocol.