diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-01-31 16:25:02 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-01-31 16:25:02 +0000 |
commit | 92fc697f221b9332fdd791213442ce2241ff9be3 (patch) | |
tree | 0695831452d4ce2f77593ef75205398935942a5e /Bonus/smb.cgi | |
parent | [w3m-dev 03720] mark remains (diff) | |
download | w3m-92fc697f221b9332fdd791213442ce2241ff9be3.tar.gz w3m-92fc697f221b9332fdd791213442ce2241ff9be3.zip |
[w3m-dev 03721] PATH_INFO support of local CGI
* local.c (CGIFN_DROOT): deleted
(CGIFN_LIBDIR): added
(CGIFN_MODE): deleted
(CGIFN_CONTAIN_SLASH): deleted
(check_local_cgi): rewrite
(cgi_filename): rewrite
(localcgi_post): support PATH_INFO
* url.c (openURL): rewrite
* Bonus/smb.cgi: use PATH_INFO
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rwxr-xr-x | Bonus/smb.cgi | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/Bonus/smb.cgi b/Bonus/smb.cgi index 32e6d86..536db89 100755 --- a/Bonus/smb.cgi +++ b/Bonus/smb.cgi @@ -3,9 +3,12 @@ # Workgroup list: file:/$LIB/smb.cgi # Server list: file:/$LIB/smb.cgi?workgroup # Sahre list: file:/$LIB/smb.cgi?//server +# file:/$LIB/smb.cgi/server # Directory: file:/$LIB/smb.cgi?//server/share # file:/$LIB/smb.cgi?//server/share/dir... +# file:/$LIB/smb.cgi/server/share # Get file: file:/$LIB/smb.cgi?//server/share/dir.../file +# file:/$LIB/smb.cgi/server/share/dir.../file # # ----- ~/.w3m/smb ----- # workgroup = <workgroup> @@ -64,9 +67,22 @@ $FILE = "F000"; $CGI = "file://" . &file_encode($ENV{"SCRIPT_NAME"} || $0); $QUERY = $ENV{"QUERY_STRING"}; +$PATH_INFO = $ENV{"PATH_INFO"}; -$_ = &file_decode($QUERY); -$DEBUG && print "DEBUG: QUERY_STRING=\"$_\"\n"; +if ($PATH_INFO =~ m@^/@) { + $_ = $PATH_INFO; + if (! m@^//@) { + $_ = "/$_"; + } + s@[\r\n\0\\"]@@g; + $DEBUG && print "DEBUG: PATH_INFO=\"$_\"\n"; + $Q = ""; +} +else { + $_ = &file_decode($QUERY); + $DEBUG && print "DEBUG: QUERY_STRING=\"$_\"\n"; + $Q = "?"; +} if (s@^//([^/]+)@@) { $server = $1; # if (!$USE_OPT_A && !defined($PASSWD)) { @@ -138,7 +154,7 @@ $DEBUG && print "DEBUG: $_"; $c = $&; s/^ //; $_ eq "." && next; - print "<a href=\"$CGI?$service" + print "<a href=\"$CGI$Q$service" . &cleanup("$file/" . &file_encode($_)) . "\">" . &html_quote($_) . "</a>" . &html_quote($c) . "\n"; @@ -183,7 +199,7 @@ sub share_list { for (sort @share) { ($_, $d, @c) = split(" "); if ($d eq 'Disk') { - print "<tr><td>+ <a href=\"$CGI?//$server/" + print "<tr><td>+ <a href=\"$CGI$Q//$server/" . &file_encode($_) . "\">" . &html_quote($_) . "</a>"; } else { @@ -213,7 +229,7 @@ sub server_list { print "<tr><td colspan=3><b>$group</b>\n"; for (sort @server) { ($_, @c) = split(" "); - print "<tr><td>+ <a href=\"$CGI?//" + print "<tr><td>+ <a href=\"$CGI$Q//" . &file_encode($_) . "\">" . &html_quote($_) . "</a><td><td>" . &html_quote("@c") . "\n"; @@ -335,7 +351,7 @@ sub print_form { Content-Type: text/html <h1>$q</h1> -<form action="$CGI?$_" method=POST> +<form action="$CGI$Q$_" method=POST> <table> <tr><td>Workgroup <td>User <td>Password <tr><td><input type=text size=8 name=group value="$WORKGROUP"> |