--- wdg-html-validator-1.6.2.orig/cgi-bin/validate.pl
+++ wdg-html-validator-1.6.2/cgi-bin/validate.pl
@@ -18,6 +18,7 @@
# Required libraries #
######################
+use lib '/usr/lib/wdg-html-validator';
use CGI;
use LWP::UserAgent;
use SpiderUA;
@@ -48,22 +49,25 @@
my $acceptHeader = 'text/html,application/xhtml+xml;q=0.9,*/*;q=0.5';
# Location of jconv Japanese character encoding converter
-my $jconv = '/usr/local/bin/jconv';
+my $jconv = '/usr/bin/jconv';
# Location of cjkvconv.pl CJK character encoding converter
-my $cjkvconv = '/usr/local/bin/cjkvconv.pl';
+my $cjkvconv = '/usr/lib/wdg-html-validator/cjkvconv.pl';
+
+# SGML directory (catalog, DTDs, SGML declarations)
+my $sgmldir = '/usr/share/sgml/html/dtd';
# SGML search path: directories containing the catalog, DTDs,
# SGML declarations, and the file to be validated
-my $sgmlSearchPath = '/usr/local/www/data/tools/validator/lib:/tmp:/var/tmp';
+my $sgmlSearchPath = '/usr/share/sgml/html:/tmp';
# Directory containing templates
-my $templates = '/usr/local/www/cgi-bin/templates/validator';
+my $templates = '/usr/share/wdg-html-validator/templates';
# nsgmls command line
# The SGML declaration and name of the temporary file storing the retrieved
# document will be appended to this string
-my $nsgmls = '/usr/local/bin/lq-nsgmls -E50 -s -R';
+my $nsgmls = '/usr/bin/onsgmls -E100 -s -R';
# Warnings to pass on command-line to nsgmls, if desired
my $nsgmlsWarnings = '-wnon-sgml-char-ref -wmin-tag';
@@ -79,8 +83,8 @@
);
# Catalog files for HTML and XHTML
-my $htmlCatalog = "catalog";
-my $xhtmlCatalog = "xhtml.soc";
+my $htmlCatalog = "/usr/share/sgml/html/entities/catalog";
+my $xhtmlCatalog = "/usr/share/sgml/html/entities/xhtml/catalog";
# Text preceding identification of the document checked
my %documentChecked = (
@@ -91,19 +95,19 @@
# Text preceding identification of the character encoding
my %characterEncoding = (
# English
- 'en' => '<a href="/tools/validator/charset.html">Character encoding</a>:'
+ 'en' => 'Character encoding:'
);
# Text preceding the level of HTML checked
my %levelOfHTML = (
# English
- 'en' => '<a href="/tools/validator/doctype.html">Level of HTML</a>:'
+ 'en' => 'Level of HTML:'
);
# Text indicating that only a check for well-formedness was performed
my %wellformednessCheck = (
#English
- 'en' => 'Checked for <strong><a href="http://www.w3.org/TR/REC-xml#dt-wellformed">well-formedness</a> only</strong> (no <a href="/tools/validator/doctype.html">DOCTYPE</a> found)'
+ 'en' => 'Checked for <strong><a href="http://www.w3.org/TR/REC-xml#dt-wellformed">well-formedness</a> only</strong> (no <a href="../doctype.html">DOCTYPE</a> found)'
);
# Default DOCTYPE for forgetful users
@@ -371,35 +375,35 @@
# SGML declarations for a given level of HTML
my %sgmlDecl = (
- 'XHTML 1.1 plus MathML 2.0 plus SVG 1.1' => "xhtml11/xml1n.dcl",
- 'XHTML 1.1 plus MathML 2.0' => "xhtml11/xml1n.dcl",
- 'MathML 2.0' => "xhtml11/xml1n.dcl",
- 'XHTML 1.1' => "xhtml11/xml1n.dcl",
- 'WML 1.3' => "xhtml1/xhtml1.dcl",
- 'WML 1.2' => "xhtml1/xhtml1.dcl",
- 'WML 1.1' => "xhtml1/xhtml1.dcl",
- 'WML 1.0' => "xhtml1/xhtml1.dcl",
- 'XHTML Basic' => "xhtml-basic10/xml1.dcl",
- 'ISO/IEC 15445:2000' => "15445.dcl",
- 'XHTML 1.0 Strict' => "xhtml1/xhtml1.dcl",
- 'XHTML 1.0 Transitional' => "xhtml1/xhtml1.dcl",
- 'XHTML 1.0 Frameset' => "xhtml1/xhtml1.dcl",
- 'HTML 4.01 Strict' => "HTML4.dcl",
- 'HTML 4.01 Transitional' => "HTML4.dcl",
- 'HTML 4.01 Frameset' => "HTML4.dcl",
- 'HTML 4.0 Strict' => "HTML4.dcl",
- 'HTML 4.0 Transitional' => "HTML4.dcl",
- 'HTML 4.0 Frameset' => "HTML4.dcl",
- 'HTML 3.2' => "HTML32.dcl",
- 'HTML 3.2 + Style' => "html-970421.decl",
- 'HTML 3.0 Draft' => "HTML3.dcl",
- 'HTML 2.0 + i18n' => "i18n.dcl",
- 'HTML 2.0' => "html.dcl",
- 'HTML 2.0 Strict' => "html.dcl",
- 'HTML 2.0 Level 1' => "html.dcl",
- 'HTML 2.0 Strict Level 1' => "html.dcl",
- 'Unknown' => "custom.dcl",
- 'Unknown (XML)' => "xhtml1/xhtml1.dcl"
+ 'XHTML 1.1 plus MathML 2.0 plus SVG 1.1' => "$sgmldir/xhtml/xhtml11/xml1n.dcl",
+ 'XHTML 1.1 plus MathML 2.0' => "$sgmldir/xhtml/1.1/xml1n.dcl",
+ 'MathML 2.0' => "$sgmldir/xhtml/1.1/xml1n.dcl",
+ 'XHTML 1.1' => "$sgmldir/xhtml/1.1/xml1n.dcl",
+ 'WML 1.3' => "$sgmldir/xhtml/1.0/xhtml1.dcl",
+ 'WML 1.2' => "$sgmldir/xhtml/1.0/xhtml1.dcl",
+ 'WML 1.1' => "$sgmldir/xhtml/1.0/xhtml1.dcl",
+ 'WML 1.0' => "$sgmldir/xhtml/1.0/xhtml1.dcl",
+ 'XHTML Basic' => "$sgmldir/xml/1.0/xhtml1.dcl",
+ 'ISO/IEC 15445:2000' => "$sgmldir/iso-15445/15445.dcl",
+ 'XHTML 1.0 Strict' => "$sgmldir/xhtml/1.0/xhtml1.dcl",
+ 'XHTML 1.0 Transitional' => "$sgmldir/xhtml/1.0/xhtml1.dcl",
+ 'XHTML 1.0 Frameset' => "$sgmldir/xhtml/1.0/xhtml1.dcl",
+ 'HTML 4.01 Strict' => "$sgmldir/4.01/HTML4.decl",
+ 'HTML 4.01 Transitional' => "$sgmldir/4.01/HTML4.decl",
+ 'HTML 4.01 Frameset' => "$sgmldir/4.01/HTML4.decl",
+ 'HTML 4.0 Strict' => "$sgmldir/4.0/HTML4.decl",
+ 'HTML 4.0 Transitional' => "$sgmldir/4.0/HTML4.decl",
+ 'HTML 4.0 Frameset' => "$sgmldir/4.0/HTML4.decl",
+ 'HTML 3.2' => "$sgmldir/html-3.2.decl",
+ 'HTML 3.2 + Style' => "$sgmldir/html-970421.decl",
+ 'HTML 3.0 Draft' => "$sgmldir/html-3.decl",
+ 'HTML 2.0 + i18n' => "$sgmldir/html-2-i18n.decl",
+ 'HTML 2.0' => "$sgmldir/html-2.decl",
+ 'HTML 2.0 Strict' => "$sgmldir/html-2.decl",
+ 'HTML 2.0 Level 1' => "$sgmldir/html-2.decl",
+ 'HTML 2.0 Strict Level 1' => "$sgmldir/html-2.decl",
+ 'Unknown' => "/usr/share/wdg-html-validator/custom.dcl",
+ 'Unknown (XML)' => "$sgmldir/xhtml/1.0/xhtml1.dcl"
);
# XHTML DTDs
@@ -474,10 +478,10 @@
'en-HTML 4.01 Strict' => '<a href="http://www.w3.org/TR/html401/">HTML 4.01</a> Strict',
'en-HTML 4.01 Transitional' => '<a href="http://www.w3.org/TR/html401/">HTML 4.01</a> Transitional',
'en-HTML 4.01 Frameset' => '<a href="http://www.w3.org/TR/html401/">HTML 4.01</a> Frameset',
- 'en-HTML 4.0 Strict' => '<a href="/reference/html40/">HTML 4.0</a> Strict',
- 'en-HTML 4.0 Transitional' => '<a href="/reference/html40/">HTML 4.0</a> Transitional',
- 'en-HTML 4.0 Frameset' => '<a href="/reference/html40/">HTML 4.0</a> Frameset',
- 'en-HTML 3.2' => '<a href="/reference/wilbur/">HTML 3.2</a>',
+ 'en-HTML 4.0 Strict' => '<a href="http://www.w3.org/TR/html4/">HTML 4.0</a> Strict',
+ 'en-HTML 4.0 Transitional' => '<a href="http://www.w3.org/TR/html4/">HTML 4.0</a> Transitional',
+ 'en-HTML 4.0 Frameset' => '<a href="http://www.w3.org/TR/html4/">HTML 4.0</a> Frameset',
+ 'en-HTML 3.2' => '<a href="http://www.w3.org/TR/REC-html32-19970114">HTML 3.2</a>',
'en-HTML 3.2 + Style' => '<a href="http://www.w3.org/TR/NOTE-html-970421">HTML 3.2 + Style</a>',
'en-HTML 3.0 Draft' => '<a href="http://www.w3.org/MarkUp/html3/">HTML 3.0 Draft</a>',
'en-HTML 2.0 + i18n' => '<a href="http://info.internet.isi.edu/in-notes/rfc/files/rfc2070.txt" title="RFC 2070: Internationalization of the Hypertext Markup Language">HTML 2.0 + <acronym title="Internationalization">i18n</acronym></a>',
@@ -1343,8 +1347,34 @@
$userAgent = new LWP::UserAgent;
$userAgent->agent("$normalUA");
}
-
+
$userAgent->protocols_allowed(['http','https','ftp']);
+ if ( -f '/etc/wdg-html-validator/wdg-html-validator.conf')
+ {
+ open (CONF, '<', '/etc/wdg-html-validator/wdg-html-validator.conf') or die "$!\n";
+ while (<CONF>)
+ {
+ chomp;
+ my ($key, $value) = /^\s*(\w+)\s*=\s*(.+)/;
+ if ($key =~ /ftp_proxy/ && defined($value))
+ {
+ $userAgent->proxy('ftp', $value);
+ }
+ elsif ($key =~ /http_proxy/ && defined($value))
+ {
+ $userAgent->proxy('http', $value);
+ }
+ elsif ($key =~ /https_proxy/ && defined($value))
+ {
+ $userAgent->proxy('https', $value);
+ }
+ elsif ($key =~ /no_proxy/ && defined($value))
+ {
+ $userAgent->no_proxy('.no.proxy', $value);
+ };
+ }
+ close CONF;
+ }
}
# Prepare request
@@ -1586,7 +1616,7 @@
&printHeader('ISO-8859-1', $lang);
&printFile("$beginningHTML.$lang");
- &error('Your browser does not appear to support form-based file upload. Please try one of our <a href="/tools/validator/">alternate methods of validation</a>.');
+ &error('Your browser does not appear to support form-based file upload. Please try one of our <a href="./">alternate methods of validation</a>.');
}