From 3abe90f8d5d864369199eb99d823627ae446001b Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Wed, 30 Jan 2002 04:42:38 +0000 Subject: [w3m-dev 02931] use POST in multipart.cgi * scripts/multipart/multipart.cgi.in: support POST method From: Hironori Sakamoto --- scripts/multipart/multipart.cgi.in | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/multipart/multipart.cgi.in b/scripts/multipart/multipart.cgi.in index 11c1370..9a01c25 100644 --- a/scripts/multipart/multipart.cgi.in +++ b/scripts/multipart/multipart.cgi.in @@ -13,8 +13,16 @@ if (! $@) { } $MIME_TYPE = "$ENV{'HOME'}/.mime.types"; +$SCRIPT_NAME = $ENV{'SCRIPT_NAME'} || $0; +$CGI = "file://$SCRIPT_NAME"; + if (defined($ENV{'QUERY_STRING'})) { - for (split('&', $ENV{'QUERY_STRING'})) { + $query = $ENV{'QUERY_STRING'}; +} elsif ($ENV{'REQUEST_METHOD'} eq 'POST') { + sysread(STDIN, $query, $ENV{'CONTENT_LENGTH'}); +} +if (defined($query)) { + for (split('&', $query)) { s/^([^=]*)=//; $v{$1} = $_; } @@ -25,7 +33,6 @@ if (defined($ENV{'QUERY_STRING'})) { if (@ARGV >= 2) { $boundary = $ARGV[1]; } - $CGI = "file:///\$LIB/multipart.cgi?file=" . &html_quote($file); } open(F, "< $file"); @@ -48,7 +55,6 @@ if (defined($boundary)) { $mbody .= "$_\n"; } } -$CGI .= "&boundary=" . &html_quote($boundary); if (defined($v{'count'})) { $count = 0; @@ -112,6 +118,10 @@ if (defined($v{'count'})) { exit; } +$qcgi = &html_quote($CGI); +$qfile = &html_quote($file); +$qboundary = &html_quote($boundary); + if ($mbody =~ /\S/) { $_ = $mbody; s/\&/\&/g; @@ -172,14 +182,20 @@ while(! $end) { s/\>/\>/g; print "
\n";
 		print $_;
+		print "\n
\n"; if ($type =~ /name=\"?([^\"]+)\"?/ || $dispos =~ /filename=\"?([^\"]+)\"?/) { $name = $1; } else { - $name = "[Content]"; + $name = "Content"; } - print "\n", &html_quote($name), ""; - print "\n\n\n"; + print "
\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "
\n" } if ($plain) { $body = &decode($body, $CONV); @@ -187,7 +203,7 @@ while(! $end) { s/\&/\&/g; s/\/\>/g; - print "
\n";
+		print "
\n\n";
 		print $_;
 		print "
\n"; } -- cgit v1.2.3