【发布时间】:2018-12-04 11:41:16
【问题描述】:
我将以下请求从 Android java 代理发送到 Apache/2.4.6 CGI perl 脚本(Linux SUSE 13.1 上的 CGI.pm 4.38 / Perl 5.18.1)。转储 $cgi 显示如下:
[Mon Jun 25 12:22:52.025910 2018] [cgi:error] [pid 20515] [client 192.168.0.10:56197] AH01215: $VAR1 = bless( {
[Mon Jun 25 12:22:52.025963 2018] [cgi:error] [pid 20515] [client 192.168.0.10:56197] AH01215: 'escape' => 1,
[Mon Jun 25 12:22:52.025977 2018] [cgi:error] [pid 20515] [client 192.168.0.10:56197] AH01215: '.fieldnames' => {},
[Mon Jun 25 12:22:52.026006 2018] [cgi:error] [pid 20515] [client 192.168.0.10:56197] AH01215: '.charset' => 'ISO-8859-1',
[Mon Jun 25 12:22:52.026019 2018] [cgi:error] [pid 20515] [client 192.168.0.10:56197] AH01215: 'use_tempfile' => 1,
[Mon Jun 25 12:22:52.026031 2018] [cgi:error] [pid 20515] [client 192.168.0.10:56197] AH01215: 'param' => {},
[Mon Jun 25 12:22:52.026044 2018] [cgi:error] [pid 20515] [client 192.168.0.10:56197] AH01215: '.parameters' => [],
[Mon Jun 25 12:22:52.026066 2018] [cgi:error] [pid 20515] [client 192.168.0.10:56197] AH01215: '.cgi_error' => '400 Bad request (malformed multipart POST)'
[Mon Jun 25 12:22:52.026076 2018] [cgi:error] [pid 20515] [client 192.168.0.10:56197] AH01215: }, 'CGI' );
当我使用 ncat 捕获请求时,我看到以下内容,但不明白哪个部分不好(请注意 ^M 会自动添加到标头中)。任何帮助表示赞赏。
POST /cgi-bin/voicerec.cgi HTTP/1.1^M
Accept-Charset: UTF-8^M
Content-Type: multipart/form-data; boundary=-----OMT-164386aa112^M
User-Agent: Dalvik/1.6.0 (Linux; U; Android 4.2.2; GT-P5113 Build/JDQ39)^M
Host: 192.168.0.12:55000^M
Connection: Keep-Alive^M
Accept-Encoding: gzip^M
Content-Length: 515^M
^M
-------OMT-164386aa112
Content-Disposition: form-data; name="action"
as_voice_rec
-------OMT-164386aa112
Content-Disposition: form-data; name="S_UID"
a
-------OMT-164386aa112
Content-Disposition: form-data; name="voice"; filename="audiorecrodtest.3gp"
Content-Type: application/x-object
Here goes the voice data file content.-------OMT-164386aa112--
【问题讨论】:
-
我正在将我的请求数据与W3.org 上的规范进行比较,并且没有发现我的请求格式有任何明显的问题。