/[pub]/suikawiki/wikidata/suikawiki-config.ph
Suika

Diff of /suikawiki/wikidata/suikawiki-config.ph

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12.4.7 by wakaba, Thu Apr 1 04:47:23 2004 UTC revision 1.15 by wakaba, Sun Apr 25 07:13:16 2004 UTC
# Line 27  use strict; Line 27  use strict;
27    }    }
28    use Message::Util::Error;    use Message::Util::Error;
29    
30    use Message::Util::QName::General [q<ExpandedURI>], {
31      'media-type' => q<http://suika.fam.cx/~wakaba/-temp/2004/04/24/mt#>,
32    };
33    
34    BEGIN {
35      if ($main::ENV{REQUEST_URI} =~ /\#/) {
36        require SuikaWiki::Output::HTTP;
37        my $out = SuikaWiki::Output::HTTP->new;
38        $out->{status_code} = 401;
39        $out->{status_phrase} = q<Request-URI MUST NOT have Fragment Identifier>;
40        $out->{entity}->{media_type} = q<text/html>;
41        $out->{entity}->{charset} = q<iso-8859-1>;
42        $out->{entity}->{language} = [q<en>];
43        $out->{entity}->{body_is_octet_stream} = 1;
44        my $ua = $main::ENV{HTTP_USER_AGENT};
45        for ($ua) {
46          s/&/&amp;/g; s/</&lt;/g; s/([^\x20-\x7E])/sprintf '&#x%02X;', ord $1/ge;
47        };
48        $out->{entity}->{body} = qq<
49          <!DOCTYPE html SYSTEM>
50          <title>401 Bad Request-URI</title>
51          <h1>Bad Request-URI</h1>
52          <p>Your Request-URI has fragment identifier but it is not allowed here.
53          It might be a bug of your user agent ($ua).  Please contact to the UA
54          vendor.</p>
55        >;
56        $out->output (output => 'http-cgi');
57        exit;
58      }
59    }
60    
61  push our @Config, sub ($) {  push our @Config, sub ($) {
62    my $WIKI = shift;    my $WIKI = shift;
63    use Cwd qw(abs_path);    use Cwd qw(abs_path);
64        
65    ## -- Filesystem path mapping    ## -- Filesystem path mapping
66    for (    for (
67       [db__cache__dir          => q"./wikidata/lock/"],       [db__cache__dir          => q"./wikidata/cache/"],
68       [db__cache_struct__file  => q"./wikidata/lock/struct.db"],       [db__cache_struct__file  => q"./wikidata/cache/struct.db"],
69       [db__content__dir        => q"./wikidata/page/"],       [db__content__dir        => q"./wikidata/page/"],
70       [db__content__error_log  => q"./wikidata/log/db-content.log"],       [db__content__error_log  => q"./wikidata/log/db-content.log"],
71       [db__bdb__home_dir       => q"./wikidata/lock/"],       [db__bdb__home_dir       => q"./wikidata/lock/"],
# Line 92  push our @Config, sub ($) { Line 123  push our @Config, sub ($) {
123                
124        ## Main content        ## Main content
125        $wiki->{db}->_set_prop_db (content => {-db_open => sub {        $wiki->{db}->_set_prop_db (content => {-db_open => sub {
126          require SuikaWiki::DB::FileSystem::YukiWikiDBNS;          require SuikaWiki::DB::FileSystem::LeafFile;
127          SuikaWiki::DB::FileSystem::YukiWikiDBNS->new          SuikaWiki::DB::FileSystem::LeafFile->new
128            (directory => $wiki->{config}->{path_to}->{db__content__dir},            (base_directory => $wiki->{config}->{path_to}->{db__content__dir},
129             logfile   => $wiki->{config}->{path_to}->{db__content__error_log},             directory_suffix => '.ns',
130             suffix    => '.txt',             file_suffix    => '.txt',
131             root_key  => $wiki->{config}->{page}->{Default},             root_key => $wiki->{config}->{page}->{Default},
132               -lock => $wiki->{var}->{db}->{lock_prop}->('content_prop'));
133          }, -db_close => sub {
134            my %opt = @_;
135            $opt{prop_info}->{-db}->close;
136            delete $opt{prop_info}->{-db};
137          }});
138    
139          ## Properties
140          $wiki->{db}->_set_prop_db (content_prop => {-db_open => sub {
141            require SuikaWiki::DB::FileSystem::LeafProp;
142            SuikaWiki::DB::FileSystem::LeafProp->new
143              (base_directory => $wiki->{config}->{path_to}->{db__content__dir},
144               directory_suffix => '.ns',
145               file_suffix    => '.prop',
146               root_key => $wiki->{config}->{page}->{Default},
147             -lock => $wiki->{var}->{db}->{lock_prop}->('content'));             -lock => $wiki->{var}->{db}->{lock_prop}->('content'));
148        }, -db_close => sub {        }, -db_close => sub {
149          my %opt = @_;          my %opt = @_;
# Line 170  push our @Config, sub ($) { Line 216  push our @Config, sub ($) {
216                
217        ## Referer Database (See Referer plugin module)        ## Referer Database (See Referer plugin module)
218        $wiki->{db}->_set_prop_db (referer => {-db_open => sub {        $wiki->{db}->_set_prop_db (referer => {-db_open => sub {
219          require SuikaWiki::DB::Hash;          require SuikaWiki::DB::FileSystem::Count;
220          new SuikaWiki::DB::Hash constructor => sub {          SuikaWiki::DB::FileSystem::Count->new
221            tie my %db, 'BerkeleyDB::Hash',            (base_directory => $wiki->{config}->{path_to}->{db__content__dir},
222                          -Filename => 'referer.db',             directory_suffix => '.ns',
223                          -Env => $bdbenv,             file_suffix    => '.ref',
224                          -Flags => DB_CREATE,             root_key => $wiki->{config}->{page}->{Default},
225                          -Mode => 0644;             auto_mkdir => 0,
226            \%db;             -lock => $wiki->{var}->{db}->{lock_prop}->('referer'));
227         };        }, -db_close => sub {
228            my %opt = @_;
229            $opt{prop_info}->{-db}->close;
230            delete $opt{prop_info}->{-db};
231        }});        }});
232    
233        ## HTTP Request Logging Database (See RequestLog plugin module)        ## HTTP Request Logging Database (See RequestLog plugin module)
# Line 252  push our @Config, sub ($) { Line 301  push our @Config, sub ($) {
301      ## Fragment identifier in URI reference      ## Fragment identifier in URI reference
302        uri_fragment => 'x-punycode',     ## Reserved for possible future use        uri_fragment => 'x-punycode',     ## Reserved for possible future use
303    };    };
304    
305      ## -- User option for media types
306      $WIKI->{config}->{ExpandedURI q<media-type:accept-media-type>} = {
307        q<IMT:text/css##> => 1,
308        q<IMT:text/plain##> => 1,
309        q<IMT:text/x-suikawiki;version="0.9"##> => 1,
310        q<IMT:application/x.suikawiki.config;version="2.0"##> => 1,
311      };
312        
313    ## -- Expires duration templates    ## -- Expires duration templates
314    $WIKI->{config}->{entity}->{expires} = {    $WIKI->{config}->{entity}->{expires} = {

Legend:
Removed from v.1.12.4.7  
changed lines
  Added in v.1.15

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24