【HTTP】另类的POST头数据 RFC1867协议格式简析
http://blog.csdn.net/ai2000ai/article/details/52161979
因为RFC1867增加了文件上传的功能,而上传文件内容自然也会被加入到HTTP的实体中。现在因为既有HTTP一般的参数实体,又有上传文件的实体,所以用boundary把每种实体进行了分割,HTTP的实体看起来将是类似下面的样子:
-----------------------------7d71f4234700b8
Content-Disposition: form-data; name="formhash"
59329e15
-----------------------------7d71f4234700b8
Content-Disposition: form-data; name="isblog"
-----------------------------7d71f4234700b8
Content-Disposition: form-data; name="fid"
104
-----------------------------7d71f4234700b8
Content-Disposition: form-data; name="subject"
test
-----------------------------7d71f4234700b8
Content-Disposition: form-data; name="iconid"
0
-----------------------------7d71f4234700b8
Content-Disposition: form-data; name="usesig"
1
-----------------------------7d71f4234700b8
Content-Disposition: form-data; name="message"
test
-----------------------------7d71f4234700b8
Content-Disposition: form-data; name="attachperm[]"
0
-----------------------------7d71f4234700b8
Content-Disposition: form-data; name="attachdesc[]"
-----------------------------7d71f4234700b8
Content-Disposition: form-data; name="attach[]"; filename=""
Content-Type: application/octet-stream
-----------------------------7d71f4234700b8
Content-Disposition: form-data; name="attachperm[]"
0
-----------------------------7d71f4234700b8
Content-Disposition: form-data; name="attachdesc[]"
-----------------------------7d71f4234700b8
Content-Disposition: form-data; name="attach[]"; filename=""
Content-Type: application/octet-stream
-----------------------------7d71f4234700b8
Content-Disposition: form-data; name="wysiwyg"
1
-----------------------------7d71f4234700b8--
很明显,增加了文件上传后,HTTP实体变得稍微复杂了,首先是通过boundary把实体分开,以便于读取,然后对FileUpload的格式也作了限制。
4、那么同样,这种格式也是需要提供Content-Length属性的,那么和简单的post数据头相比较,就可以发现,变化的地方有:
......
Content-Type:
......
Content-Length:
......
数据体 goes here~
注意到这几个地方的变化后,就可以像往常一样post了