[w3m-dev 02931] use POST in multipart.cgi
* scripts/multipart/multipart.cgi.in: support POST method From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
		| @@ -1,3 +1,8 @@ | |||||||
|  | 2002-01-30  Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> | ||||||
|  |  | ||||||
|  | 	* [w3m-dev 02931] use POST in multipart.cgi | ||||||
|  | 	* scripts/multipart/multipart.cgi.in: support POST method | ||||||
|  |  | ||||||
| 2002-01-30  Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> | 2002-01-30  Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> | ||||||
|  |  | ||||||
| 	* [w3m-dev 02930] Re: fixed w3mmail.cgi | 	* [w3m-dev 02930] Re: fixed w3mmail.cgi | ||||||
| @@ -2405,4 +2410,4 @@ | |||||||
| 	* release-0-2-1 | 	* release-0-2-1 | ||||||
| 	* import w3m-0.2.1 | 	* import w3m-0.2.1 | ||||||
|  |  | ||||||
| $Id: ChangeLog,v 1.275 2002/01/30 04:27:32 ukai Exp $ | $Id: ChangeLog,v 1.276 2002/01/30 04:42:38 ukai Exp $ | ||||||
|   | |||||||
| @@ -13,8 +13,16 @@ if (! $@) { | |||||||
| } | } | ||||||
| $MIME_TYPE = "$ENV{'HOME'}/.mime.types"; | $MIME_TYPE = "$ENV{'HOME'}/.mime.types"; | ||||||
|  |  | ||||||
|  | $SCRIPT_NAME = $ENV{'SCRIPT_NAME'} || $0; | ||||||
|  | $CGI = "file://$SCRIPT_NAME"; | ||||||
|  |  | ||||||
| if (defined($ENV{'QUERY_STRING'})) { | 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/^([^=]*)=//; | 		s/^([^=]*)=//; | ||||||
| 		$v{$1} = $_; | 		$v{$1} = $_; | ||||||
| 	} | 	} | ||||||
| @@ -25,7 +33,6 @@ if (defined($ENV{'QUERY_STRING'})) { | |||||||
| 	if (@ARGV >= 2) { | 	if (@ARGV >= 2) { | ||||||
| 		$boundary = $ARGV[1]; | 		$boundary = $ARGV[1]; | ||||||
| 	} | 	} | ||||||
| 	$CGI = "file:///\$LIB/multipart.cgi?file=" . &html_quote($file); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| open(F, "< $file"); | open(F, "< $file"); | ||||||
| @@ -48,7 +55,6 @@ if (defined($boundary)) { | |||||||
| 		$mbody .= "$_\n"; | 		$mbody .= "$_\n"; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| $CGI .= "&boundary=" . &html_quote($boundary); |  | ||||||
|  |  | ||||||
| if (defined($v{'count'})) { | if (defined($v{'count'})) { | ||||||
| 	$count = 0; | 	$count = 0; | ||||||
| @@ -112,6 +118,10 @@ if (defined($v{'count'})) { | |||||||
| 	exit; | 	exit; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | $qcgi = &html_quote($CGI); | ||||||
|  | $qfile = &html_quote($file); | ||||||
|  | $qboundary = &html_quote($boundary); | ||||||
|  |  | ||||||
| if ($mbody =~ /\S/) { | if ($mbody =~ /\S/) { | ||||||
| 	$_ = $mbody; | 	$_ = $mbody; | ||||||
| 	s/\&/\&/g; | 	s/\&/\&/g; | ||||||
| @@ -172,14 +182,20 @@ while(! $end) { | |||||||
| 		s/\>/\>/g; | 		s/\>/\>/g; | ||||||
| 		print "<pre>\n"; | 		print "<pre>\n"; | ||||||
| 		print $_; | 		print $_; | ||||||
|  | 		print "\n</pre>\n"; | ||||||
| 		if ($type =~ /name=\"?([^\"]+)\"?/ || | 		if ($type =~ /name=\"?([^\"]+)\"?/ || | ||||||
| 			$dispos =~ /filename=\"?([^\"]+)\"?/) { | 			$dispos =~ /filename=\"?([^\"]+)\"?/) { | ||||||
| 			$name = $1; | 			$name = $1; | ||||||
| 		} else { | 		} else { | ||||||
| 			$name = "[Content]"; | 			$name = "Content"; | ||||||
| 		} | 		} | ||||||
| 		print "\n<a href=\"$CGI&count=$count\">", &html_quote($name), "</a>"; | 		print "<form method=POST action=\"$qcgi\">\n"; | ||||||
| 		print "\n\n</pre>\n"; | 		print "<input type=hidden name=file value=\"$qfile\">\n"; | ||||||
|  | 		print "<input type=hidden name=boundary value=\"$qboundary\">\n"; | ||||||
|  | 		print "<input type=hidden name=count value=\"$count\">\n"; | ||||||
|  | 		print "<input type=submit name=submit value=\"", | ||||||
|  | 			&html_quote($name), "\">\n"; | ||||||
|  | 		print "</form>\n" | ||||||
| 	} | 	} | ||||||
| 	if ($plain) { | 	if ($plain) { | ||||||
| 		$body = &decode($body, $CONV);  | 		$body = &decode($body, $CONV);  | ||||||
| @@ -187,7 +203,7 @@ while(! $end) { | |||||||
| 		s/\&/\&/g; | 		s/\&/\&/g; | ||||||
| 		s/\</\</g; | 		s/\</\</g; | ||||||
| 		s/\>/\>/g; | 		s/\>/\>/g; | ||||||
| 		print "<pre>\n"; | 		print "<pre>\n\n"; | ||||||
| 		print $_; | 		print $_; | ||||||
| 		print "</pre>\n"; | 		print "</pre>\n"; | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user