关于解析http协议boundary字段
常书 2017-08-21 07:31:24 问下http协议中的这个字段大小最长多大,目前在解析这个字段希望给它分配一个固定字段,使用动态申请难以释放内存
找到答案了,不包含前面2个连字符,最大70个字符
https://stackoverflow.com/questions/8250154/html-multipart-form-maximum-length-of-boundary-string
摘录如下:
RFC2616 (HTTP/1.1) section "3.7 Media Types" says that the allowed types in the Content-Type header is defined by RFC1590 (Media Type Registration Procedure).
RFC1590 updates RFC-1521(MIME).
RFC1521 says that a boundary "must be no longer than 70 characters, not counting the two leading hyphens".
The same text also appears in RFC2046 which supposedly obsoletes RFC1521.