/[suikacvs]/test/html-webhacc/cc.cgi
Suika

Contents of /test/html-webhacc/cc.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Wed Jun 27 13:30:15 2007 UTC (19 years, 2 months ago) by wakaba
Branch: MAIN
Changes since 1.2: +26 -9 lines
Style sheet

</
1 #!/usr/bin/perl
2 use strict;
3
4 use lib qw[/home/httpd/html/www/markup/html/whatpm
5 /home/wakaba/work/manakai/lib
6 /home/wakaba/public_html/-temp/wiki/lib];
7 use CGI::Carp qw[fatalsToBrowser];
8 use Scalar::Util qw[refaddr];
9
10 use SuikaWiki::Input::HTTP; ## TODO: Use some better CGI module
11
12 sub htescape ($) {
13 my $s = $_[0];
14 $s =~ s/&/&amp;/g;
15 $s =~ s/</&lt;/g;
16 $s =~ s/>/&gt;/g;
17 $s =~ s/"/&quot;/g;
18 $s =~ s!([\x00-\x09\x0B-\x1F\x7F-\x80])!sprintf '<var>U+%04X</var>', ord $1!ge;
19 return $s;
20 } # htescape
21
22 my $http = SuikaWiki::Input::HTTP->new;
23
24 ## TODO: _charset_
25
26 my $input_format = $http->parameter ('i') || 'text/html';
27 my $inner_html_element = $http->parameter ('e');
28 my $input_uri = 'thismessage:/';
29
30 my $s = $http->parameter ('s');
31 if (length $s > 1000_000) {
32 print STDOUT "Status: 400 Document Too Long\nContent-Type: text/plain; charset=us-ascii\n\nToo long";
33 exit;
34 }
35
36 my @nav;
37 print STDOUT qq[Content-Type: text/html; charset=utf-8
38
39 <!DOCTYPE html>
40 <html lang="en">
41 <head>