I see the problem now
It is a bug in CGI
# See RFC 1867, 2183, 2045
# NB: File content will be loaded into memory should
# content-disposition parsing fail.
my ($filename) = $header{'Content-Disposition'}
=~/ filename=(("[^"]*")|([a-z\d!\#'\*\+,\.^_\`\{\}\
+|\~]*))/i;
$filename ||= ''; # quench uninit variable warning
$filename =~ s/^"([^"]*)"$/$1/;
It is a bug in CGI::Simple
my ( $param ) = $unfold =~ m/form-data;\s+name="?([^\";]*)"?/;
my ( $filename )
= $unfold =~ m/name="?\Q$param\E"?;\s+filename="?([^\"]*)"?/;
Example quoted string request my $VAR1 = "POST http://localhost/cgi-bin/upload_quotes.pl\nContent-Le
+ngth: 138\nContent-Type:".
" multipart/form-data; boundary=xYzZY\n\n--xYzZY\r\nContent-Di
+sposition: form".
"-data; name=\"file\"; filename=\"stupid \\\"quoted\\\" filena
+me.txt\"\r\n-Content:".
" stupid content\r\n\r\n\r\n--xYzZY--\r\n";
I'd have suggested a regex, I've seen one many times, but I'm not up on the rfcs
http://tools.ietf.org/html/rfc1521
value := token / quoted-string
token := 1*<any (ASCII) CHAR except SPACE, CTLs,
or tspecials>
tspecials := "(" / ")" / "<" / ">" / "@"
/ "," / ";" / ":" / "\" / <">
/ "/" / "[" / "]" / "?" / "="
; Must be in quoted-string,
; to use within parameter values
http://tools.ietf.org/html/rfc2822#section-3.2.5
FWS = ([*WSP CRLF] 1*WSP) / ; Folding white space
obs-FWS
ctext = NO-WS-CTL / ; Non white space controls
%d33-39 / ; The rest of the US-ASCII
%d42-91 / ; characters not including "(
+",
%d93-126 ; ")", or "\"
ccontent = ctext / quoted-pair / comment
comment = "(" *([FWS] ccontent) [FWS] ")"
CFWS = *([FWS] comment) (([FWS] comment) / FWS)
qtext = NO-WS-CTL / ; Non white space controls
%d33 / ; The rest of the US-ASCII
%d35-91 / ; characters not including "\
+"
%d93-126 ; or the quote character
qcontent = qtext / quoted-pair
quoted-string = [CFWS]
DQUOTE *([FWS] qcontent) [FWS] DQUOTE
|