git.iko.soy/typeable/pandoc
on master help sign in
Fixed URL regex in html2x.pl, and added a command to the pipe

to truncate input pages to 100K. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1019 788f1e2b-df1e-0410-8736-df70ead52e1b

commit9ed11f4500a04f42d46be8b654f8782d1ef268ec authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSat 15 Sep 2007, 21:30 (19 years ago) parentbf100f8
1 file changed+4−2
web/html2x.pl+4−2
web/html2x.pl+4−2
@@ -19,14 +19,16 @@ if ($format =~ /^markdown\+$/) {
1919}
2020
2121# Validate URL and format
22−unless ($url =~ /^(https?:\/\/)?[\w#?_-]+(\.[\w#?_-]+)+[\w\/#?_.-]*$/) {
22+unless ($url =~ /^(https?:\/\/)?[\w#_-]+(\.[\w#_-]+)+[\w\/#=?_.-]*$/) {
2323 die "Illegal URL: $url\n" ;
2424}
2525unless ($format =~ /^markdown\+?|rst|latex|context|rtf|man|docbook$/) {
2626 die "Illegal format: $format\n";
2727}
2828
29−my $output = `wget -O- $url | tidy -asxhtml -utf8 | pandoc -w $format $options`;
29+# Note - pass through head to truncate file to 100K if greater.
30+# This should prevent certain kinds of DoS attacks.
31+my $output = `wget -O- $url | head -c100000 | tidy -asxhtml -utf8 | pandoc -w $format $options`;
3032if ($output =~ /^\s*$/) {
3133 print start_html,
3234 h1("No output"),