Skip to content

Commit

Permalink
Restore dynamic-site
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Jun 5, 2024
1 parent 259f066 commit 1c0820e
Show file tree
Hide file tree
Showing 307 changed files with 14,693 additions and 0 deletions.
1 change: 1 addition & 0 deletions dynamic-site/__history__.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body></body></html>
72 changes: 72 additions & 0 deletions dynamic-site/bin/check_page.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env perl

use strict;
use warnings;

BEGIN {
if($ENV{'REMOTE_ADDR'}) {
# A web crawler has found this file stored on a site
exit(0);
}
}

no lib '.';

use Gzip::Faster;
use Test::Most;
use Test::CGI::External; # https://metacpan.org/pod/release/BKB/Test-CGI-External-0.02/lib/Test/CGI/External.pod
use FindBin;
use autodie qw(:all);

$ENV{'GATEWAY_INTERFACE'} = 'CGI/1.1';
$ENV{'SERVER_PORT'} = 443;
$ENV{'NO_CACHE'} = 1;

my $t = Test::CGI::External->new();

$ENV{'REMOTE_ADDR'} = '212.159.106.41'; # Send the logging to a file not stdout

# $t->set_cgi_executable("$FindBin::Bin/bb-links.fcgi", '--mobile');
$t->set_cgi_executable("$FindBin::Bin/../cgi-bin/page.fcgi");

my %options;

diag('Basic sanity tests');
$t->set_verbosity(1);

diag('Test no arguments');
$t->run(\%options);

# Don't do these tests earlier, since the 300 response won't be compressed or cached
$t->do_compression_test(1);
$t->do_caching_test(1);

$ENV{'HTTP_ACCEPT_LANGUAGE'} = 'en';
$options{'REQUEST_METHOD'} = 'GET';
$options{'QUERY_STRING'} = 'page=people&home=1';
$t->run(\%options);
# diag($options{'body'});

$options{'QUERY_STRING'} = 'page=mailto';
$t->run(\%options);
# diag($options{'body'});

$options{'QUERY_STRING'} = 'page=mailto&lang=en';
$t->run(\%options);

$ENV{'HTTP_ACCEPT_LANGUAGE'} = 'fr';
$options{'QUERY_STRING'} = 'page=mailto&lang=fr';
$t->run(\%options);
# diag($options{'body'});

diag('test not implemented');
$t->test_not_implemented();

diag('test not allowed');
$t->test_method_not_allowed('DELETE');

diag('test HTTP 411');
$t->test_411();

diag('Finishing');
done_testing();
10 changes: 10 additions & 0 deletions dynamic-site/bin/tosqlite
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set -e

cd ../data && rm -f *.sql
csv2sqlite -o sep_char='!' surnames.csv surnames.sql
[ -r censuses.csv ] && csv2sqlite -o sep_char='!' censuses.csv censuses.sql
csv2sqlite -o sep_char='!' name_date.csv name_date.sql
csv2sqlite -o sep_char='!' surname_date.csv surname_date.sql
csv2sqlite -o sep_char='!' -o allow_loose_quotes=1 people.csv people.sql
[ -r todo.csv ] && csv2sqlite -o sep_char='!' todo.csv todo.sql
csv2sqlite -o sep_char='!' history.csv history.sql
Loading

0 comments on commit 1c0820e

Please sign in to comment.