- 1 名前:ミスター有料 [2005/09/28(水) 17:37:20 ID:LCMjwTe9]
-
Level3-BBS Script www.3lab.org/ 0ch 0ch.mine.nu/ 鏡の国 script.s16.xrea.com/ 本7 ◆uPD9aFm9hI、クレクレ厨、教えて君、DQNは書き込まないでください。 また、↑の書き込みを見つけても放置してください。すぐに「ウザい」とレスをつけてしまう 反射神経がとても優れている・他人を無視できない方もご遠慮願います。 もしどうしても無視できない時は、話題を変えてレスしましょう。
- 615 名前:nobodyさん mailto:sage [2006/09/28(木) 08:35:21 ID:???]
- #!/usr/bin/perl -w
use strict; use POSIX qw(strftime); use File::stat; use Time::Local qw(timegm); if ($#ARGV != 1 || $ARGV[0] =~ /\W/ || $ARGV[1] =~ /\D/) { print <<EOT; Status: 400 Bad Request Content-Type: text/plain 400 Bad Request EOT exit; } my $fname = "../$ARGV[0]/dat/$ARGV[1].dat"; my $st; if (!($st = stat($fname))) { print <<EOT; Status: 404 Not Found Content-Type: text/plain 404 Not Found EOT exit; }
- 616 名前:nobodyさん mailto:sage [2006/09/28(木) 08:36:06 ID:???]
- my $ims = !$ENV{HTTP_IF_MODIFIED_SINCE}
? 0 : $ENV{HTTP_IF_MODIFIED_SINCE} =~ /^\w{3,}, {1,2}(\d{1,2})[ -](Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[ -](\d{2,4}) {1,2}(\d{1,2}):(\d{2}):(\d{2}) GMT$/ ? timegm($6, $5, $4, $1, index('JanFebMarAprMayJunJulAugSepOctNovDec', $2) / 3, $3) : $ENV{HTTP_IF_MODIFIED_SINCE} =~ /^\w{3} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) {1,2}(\d{1,2}) {1,2}(\d{1,2}):(\d{2}):(\d{2}) (\d{4})$/ ? timegm($5, $4, $3, $2, index('JanFebMarAprMayJunJulAugSepOctNovDec', $1) / 3, $6) : 0; if ($ims ge $st->mtime) { print "Status: 304 Not Modified\n\n"; exit; } my $mtime = strftime('%a, %d %b %Y %T GMT', gmtime($st->mtime)); print <<EOT; Content-Type: application/xml; charset=Shift_JIS Last-Modified: $mtime Cache-Control: max-age=5 <?xml version="1.0" encoding="Shift_JIS"?> <text><![CDATA[ EOT if (open(DAT, $fname)) { while (<DAT>) { print; } close(DAT); } print "]]></text>\n";
|

|