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=q$-J}$K$D$$$F$O!"(B $B$3$3(B$B$r;29M$K$7$F(B $B$/$@$5$$!#$G$-$l$P(Bserver$B$N4IM}$^$7$$$G$9!#(B

$B0J2<$N%I%-%e%a%s%H$r;29M$K$7$^$7$?!#(B

$B$G$O!"$O$8$^$j$O$8$^$j!#(B
CGI(The Common Gateway Interface)$B$H$O!"(Bhttp server$BB&$G!"(B script$B$r8F$S=P$9!"(Bserver$BB&$G client$BB&$G$N(Bscript$B $BJ8>O(B$B$r;2>H$N$3$H!#(B FORM$B$H$$$&$N$O!"(BHTML+$B$G5,Dj$5$l$?%?%0$G!"(BHTML$BJ8>OCf$G(Binput field$B$r:n$l$k$h$&$K$9$k$b$N$G$"$k!#(B

CGI$B$N4JC1$J;H$$J}(B

$BNc$($P!"(BMosaic$B$J$I$N(Bclient$B$+$i0J2<$N(BURL$B$r(BOpen$B$7$F$_$F$[$7$$!#(B UNIX$B$N(Bdate$B$N=PNO$,$G$F$/$k$O$:$@!#(B

http://andro.sfc.keio.ac.jp/cgi-bin/date

$B$3$l$O8=:_$N(Bandro.sfc.keio.ac.jp$B$H$$$&(Bserver$B$N;~4V$G$"$k!#(B server$BB&$G(Bdate$B$r

==> /usr/local/etc/httpd/cgi-bin/date <==
#!/bin/sh

DATE=`which date`

echo Content-type: text/plain
echo

if [ -x $DATE ];  then
	$DATE
else 
	echo Cannot find date command on this system.
fi
==> end <==

shell script$B$NCf?H$O!"$h$&$9$k$K8+$F$o$+$k$H$*$j!"I8=`=PNO$K(B $B$@$7$?$b$N$,(Bhtml$B$N%U%!%$%k$H$7$F=hM}$5$l$F!"(BMosaic$B$N2hLL$K$G(B $B$F$/$k!#(B

$B$$$/$D$+Cm0U!#(B

echo Content-type: text/plain
echo

$B$3$N(B2$B9T$rK:$l$F$O$J$i$J$$!#$3$l$rK:$l$k$H!"$G$F$3$J$$!#(B

$B$^$?!"(Bserver$BB&$G(Bscript$B$,L58B%k!<%W$K$O$$$k$H!"(Bclient$B$O%"%/%;(B $B%9$7$?>uBV$G$H$^$C$F$7$^$&!#(B

$B$3$N(Bdate$B$H$$$&(Bscript$B$O!"(BNCSA httpd$B$K$D$$$F$-$?$b$N$G$"$k!#(B /usr/local/etc/httpd/cgi-bin$B$H$$$&$N$,(Bdefault$B$N(Bcgi script$B$N(B $BCV$+$l$k$H$3$m$G$"$k!#(B

$B$b$7$"$J$?$,(Bserver$B$N4IM}

http://$B$"$J$?$N(Bserver$BL>(B/cgi-bin/date

$B$H!"

cgi-bin$B$K$D$$$F$O!"@_Dj%U%!%$%k(B

/usr/local/etc/httpd/conf/srm.conf

$B$GJQ$($i$l$k!#(B

# ScriptAlias: This controls which directories contain server scripts.
# Format: ScriptAlias fakename realname

ScriptAlias /cgi-bin/ /usr/local/etc/httpd/cgi-bin/

$B$3$3$rJQ99$9$l$P(Bscript$B$NCV$->l=j$r<+M3$K7hDj$G$-$k!#$b$A$m$s!"(B $B$3$N(Bdirectory$B0J30$N$H$3$m$K$*$$$F$"$k(Bscript$B$O

$B$3$l$G(Bserver$BB&$G$N(Bscript$BpJs$rAw$k(B $B$3$H$,$G$-$J$$!#

FORM$B$N4JC1$J;H$$J}(B

Mosaic$B$N(Bver.1.0$B$N$3$m$O!"(BISINDEX$B$H$7$Fl9g$O$R$H$D$N>pJs$7$+Aw$l$J$+$C$?$N$,!"$b$C$H(B $B$$$m$$$mAw$l$k$h$&$K$J$C$?$H$$$&$3$H$@!#(B

$BKM$N(Badd-name.html$B$r%5%s%W%k$H$7$F8+$F$_$h$&!#(B

=== add-name.html ===
<FORM METHOD="POST" ACTION="/cgi-bin/add-name">

Please add your name to my visited person list.<P>

Please input your name: <INPUT NAME="name" SIZE=30> <P>
Please input your mail address: <INPUT NAME="address" SIZE=40> <P>
Please input your home page URL: <INPUT NAME="url" SIZE=40> <P>
If you don't have your home page, please keep it brank.<P>

After input these field, press this button:
<INPUT TYPE="submit" VALUE="ADD"> <P>

</FORM>

$BM>J,$J$H$3$m$O:o$C$F$"$k!#$=$l$>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*$K(Bsubmit$B$K$J$k!#J#?t$N(B INPUT$B$,$"$k$H$-$OI,$:$3$l$r:n$i$J$/$F$O$J$i$J$$!#(BVALUE="ADD" $B$H$$$&$N$O!"%\%?%s$K$D$/L>A0!#(B

TYPE$B$H$$$&$N$O$b$C$H$$$m$$$m$"$k$,!"$H$j$"$($:>JN,!#(B

$B>\$7(B $B$/$O!"(B Fill-out Form$B$K$D$$$F$NJ8>O(B$B$rFI$s$G$_$F$[$7$$!#(B submit$B$,2!$5$l$k$H!"(BFORM$B$N$H$3$m$N(BACTION$B$K<($5$l$k$b$N$,pJs$,(Bserver$B$X$HAw$i$l(B $B$k!#pJs$N

FORM+CGI$B$N4JC1$J;H$$J}(B

ISINDEX$B$N$3$m$N>pJs$NAw$i$l$k7A<0$O!"(B
http://andro.sfc.keio.ac.jp/cgi-bin/finger?eto

$B$N$h$&$K!"(B?$B$N$"$H$K>pJs$,$/$C$D$/$H$$$&7A<0$@$C$?!#(B $B$3$N$H$-$O!"0l$D$7$+>pJs$,Aw$l$J$+$C$?!#(B

FORM$B$G$O$I$N$h$&$K3HD%$5$l$F$$$k$+$H$$$&$H!">e5-$N(BINPUT$B%?%0(B $B$N(BNAME$B$H$$$&$H$3$m$K$D$$$F$$$kL>A0$r;H$C$F;XDj$9$k$h$&$K$J$C(B $B$F$$$k!#(B $B$?$H$($P>e5-$N(Bhtml$B$G!">pJs$,0J2<$N$h$&$K$J$C$F$$$?$H$9$k!#(B

name
ETO Kouichirou
address
[email protected]
url
http://andro.sfc.keio.ac.jp/eto/

$B$3$N$H$-!"(B

name=ETO+Kouichirou&[email protected]&url=http%3a%2f%2fandro.sfc.keio.ac.jp%2feto%2f

$B$H$$$&7A$GAw$i$l$k!#(BGET$B$N>l9g$O$3$l$,4D6-JQ?t(BQUERY_STRING$B$K!"(B POST$B$N>l9g$O$3$l$,I8=`F~NO$+$iAw$i$l$k!#(B

$B8+$k$H$o$+$k$h$&$K!"(B

  • $B>pJs$H>pJs$N4V$O!"(B'&'$B$G6h@Z$i$l$k!#(B
  • NAME$B$HFbMF$N4V$O!"(B'='$B$G6h@Z$i$l$k!#(B
  • $B6uGr(B ' ' $B$O!"(B'+' $B$KJQ49$5$l$k!#(B
  • $BFC
$BD9$5$,(BCONTENT_LENGTH$B$H$$$&4D6-JQ?t$GEO$5$l$k$N$G!"(BPOST$B$N>l9g!"(B $B$=$ND9$5$N$V$s$@$1FI$_$H$k$h$&$K$9$k!#(Bshell$B$G!"(B

cat > $tmp

$B$H$+$d$C$F$b$@$a!#=*$j$rFI$_$H$C$F$/$l$J$$$+$i!"$=$3$G;_$^$C(B $B$F$7$^$&!#(B

GET$B$H(BPOST$B$N6hJL$O!"(BREQUEST_METHOD$B$H$$$&4D6-JQ?t$GAw$i$l$k!#(B GET$B$N>l9g$O(BQUERY_STRING$B$H$$$&4D6-JQ?t$K>pJs$,F~$k!#(B

$B$H$$$&$3$H$G!"$3$l$i$r$U$^$($?>e$G!"$3$l$r(Bperl$B$G=q$$$F$_$h$&!#(B $B$3$l$,(Badd-name script$B$N(B$BK\BN(B$B!#$3$l(B $B$O!"(Bcomp.infosystems.www$B$GN.$l$F$$$?(Bperl$B$K$h$k(Bcgi$B$N=q$-J}$N(B news$B$r;29M$K$7$F=q$$$?$b$N$@!#$3$l$,(B $B$b$H$N(B $B%5%s%W%k(B$B!#$3$l$r85$K$$$m$$$m2~JQ$r2C$($F$$$k!#(B $B0J2<$K!">/$7$E$D2r@b$r2C$($F$$$/!#(B

&cgi'header; $B$^$:!"Nc$N(B

Content-type: text/html

$B$H$$$&%X%C%@!<$r=q$$$F$$$k!#(B

&cgi'decode;

$B$H$$$&$H$3$m$GpJs$r(B $BF~$l$F$$$k!#(B&cgi'decode$B$NCf?H$r8+$F$_$h$&!#(B

        if ($ENV{'REQUEST_METHOD'} eq "POST"){
                $n_read = sysread(STDIN, $args, $ENV{'CONTENT_LENGTH'});
        } else {
                $args = $ENV{'QUERY_STRING'};
        }

POST$B$+(BGET$B$+$rH=JL$7$F!"(B$args$B$KAw$i$l$F$-$?>pJs$r$$$l$F$$$k!#(B

        @terms = split('&', $args);

$B$^$:!"(B&$B$G6h@Z$k!#(B

        foreach (@terms) {
                ($tag, $value) = split(/=/, $_, 2);

= $B$G6h@Z$C$F!"(B

                $value =~ s/\+/ /g;

+ $B$r(B ' ' $B$KJQ49!#(B

                $value =~ s/%(..)/pack("c", hex($1))/ge;

%?? $B$r85$NJ8;zNs$KJQ49!#(B

                $tags{$tag} = $value;           # tags is global

cgi_tags $B$KO"A[G[Ns$N7A$G$$$l$F!"(Breturn$B!#(B

	$cont = $cgi_tags{$tag};
	$cont =~ s/&/&amp;/g;
	$cont =~ s/</&lt;/g;
	$cont =~ s/>/&gt;/g;

$B$3$3$G!"(B& < >$B$rJN,!#(B $B$3$l$r%Q%C%1!<%8$N7A$K=q$-D>$7$F$_$?!#(B here

$B$@$$$?$$$3$N$/$i$$$o$+$l$P<+J,$G$b(BCGI$B$H(BFORM$B$N5!G=$rMxMQ$7$?(B $B%Z!<%8$r:n$l$k$N$G$O$J$$$+$H;W$&!#F|K\$N(BWWW$B$G$b!"$3$l$i$N5!(B $BG=$rMxMQ$7$?%Z!<%8$,A}$($k$H$&$l$7$$!#(B

$B:G8e$K!"$3$N%I%-%e%a%s%H$rFI$s$@?M$O!"$<$R(B$B$3$3(B$B$r%"%/%;%9$7$F!"KM$NK,LdA0$r$D$1$/$o$($F$$$C$F$/$@$5$$!#(B:-)

$B$=$l$G$O!"(BHave a Happy Networking!

history:

  • ver.0.1 94/01/23 draft
  • ver.0.2 94/02/08 WWW$B$G8x3+(B
  • ver.0.3 94/02/09 infotalk$B$G8x3+(B
  • ver.0.3 94/07/26 cgi.pl$B$J$I$NJQ99(B
  • 94/11/24 www.bio.cam.ac.uk $B$N(BURL$B$rJQ99(B
  • 97/04/20 rename .pl to .txt
Date: 94/07/26


Please E-mail comments and questions to
ETO Kouichirou <[email protected]>