Subject: | Content-Disposition header problem with HTTP::Request::Common |
libwww-perl-5.805
module HTTP::Request::Common.pm, line 138:
$disp .= qq(; filename="$usename") if $usename;
$usename contains file name without path, then the module doesn't
generate filename attribute of Content-Disposition header when $usename
== '0'.
That makes serious problem to some PHP programs. PHP core generates
follwing 3 global hash variables before starting script: $_GET $_POST
$_FILES. When some part of request contains filename attribute, PHP core
adds its part to $_FILES. Otherwise to $_POST.
# test code
$req = POST $url,
Content_Type => 'form-data',
Content => [ 'file' => ['foo/bar/0']];
# header with problem
Content-Disposition: form-data; name="file"
# correct header
Content-Disposition: form-data; name="file"; filename="0"