[英]python cgi.FieldStorage is empty on chunked transport of type multipart/form-data
Tested by apache-2.2.22 the python 3.3 cgi.FieldStorage() works perfectly for multipart/form-data if Content-Length is specified, however, the form data is empty if chunked transport is used. 如果指定了Content-Length,则经过apache-2.2.22测试的python 3.3 cgi.FieldStorage()可以完美地用于multipart / form-data,但是,如果使用分块传输,则表单数据为空。 Please see the following two test cases. 请参阅以下两个测试用例。
Test_input_ok: Test_input_ok:
POST /cgi-bin/1.cgi?bla=ddd HTTP/1.1
Host: localhost
Content-Type: multipart/form-data; boundary=abcdefghdddddd
Content-Length: 162
--abcdefghdddddd
Content-Disposition: form-data; name="filename"; filename="freemind"
Content-Type: application/octet-stream
aaaaaaaaaa
--abcdefghdddddd--
FieldStorage result is OK: FieldStorage(None, None, [MiniFieldStorage('bla', 'ddd'), FieldStorage('filename', 'freemind', b'aaaaaaaaaa\\r\\n')])
FieldStorage结果正常: FieldStorage(None, None, [MiniFieldStorage('bla', 'ddd'), FieldStorage('filename', 'freemind', b'aaaaaaaaaa\\r\\n')])
Test_input_chunk_transport: Test_input_chunk_transport:
POST /cgi-bin/1.cgi?bla=ddd HTTP/1.1
Host: localhost
Transfer-Encoding: chunked
Content-Type: multipart/form-data; boundary=abcdefghdddddd
A6
--abcdefghdddddd
Content-Disposition: form-data; name="filename"; filename="freemind"
Content-Type: application/octet-stream
aaaaaaaaaa
--abcdefghdddddd--
0
FieldStorage(None, None, [MiniFieldStorage('bla', 'ddd'), FieldStorage(None, None, '')])
MIME附件的FieldStorage(None, None, [MiniFieldStorage('bla', 'ddd'), FieldStorage(None, None, '')])
结果为空(但是,至少存在): FieldStorage(None, None, [MiniFieldStorage('bla', 'ddd'), FieldStorage(None, None, '')])
The apache server does not log any errors. apache服务器不记录任何错误。
Any idea what I'm missing here? 知道我在这里缺少什么吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.