1
POST /upload HTTP/1.1
Host: assets.drop.io
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2
009042316 Firefox/3.0.10
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Content-Length: 5728
Content-Type: multipart/form-data; boundary=--------MalolHCBdarysNYMHZbIvjbD


--------MalolHCBdarysNYMHZbIvjbD
Content-Disposition: form-data; name="api_key"

0b8a12109c3a1bfc4ba94aec926e1f9cfd8bb6f0
--------MalolHCBdarysNYMHZbIvjbD
Content-Disposition: form-data; name="drop_name"

4pgvoxc
--------MalolHCBdarysNYMHZbIvjbD
Content-Disposition: form-data; name="version"

2.0
--------MalolHCBdarysNYMHZbIvjbD
Content-Disposition: form-data; name="rachel"; filename="rachel"
Content-Type: application/octet-stream

BMv¶
--------MalolHCBdarysNYMHZbIvjbD--

我得到的回应是:错误的请求。在响应的 HTML 中有这样的内容:

:MultiPartParseError: bad content body:
'
----------MalolHCBdarysNYMHZbIvjbD' should == '----------MalolHCBdarysNYMHZbIvjbD
'></td></tr>
4

2 回答 2

3

答案就在你的问题中。回应说分隔线应该'----------MalolHCBdarysNYMHZbIvjbD '' ----------MalolHCBdarysNYMHZbIvjbD'

查看前导和尾随空格。

于 2010-01-02T21:32:38.723 回答
3

multipart/form-data消息的示意语法如下:

Content-Type: multipart/form-data; boundary=boundary

--boundary
Content-Disposition: form-data; name="field 1"

data 1
--boundary
Content-Disposition: form-data; name="field 2"

data 2
⋮
--boundary
Content-Disposition: form-data; name="field N"

data N
--boundary--

所以内部边界是--boundary--后接边界值),最后是--boundary----后接边界值,后接--)。

在您的情况下,您只是缺少领先的--.

于 2010-01-02T21:40:58.700 回答