summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorville <ville@localhost>2009-12-12 20:06:36 +0000
committerville <ville@localhost>2009-12-12 20:06:36 +0000
commit21719c14099a85161ed5488a4c7b1e3db6611073 (patch)
tree3daaa70b3f90435a43f3c03b8ce424f4a43b61fd
parent1177dfa08060de79a7e3030329f0b05ed6e0c164 (diff)
downloadmarkup-validator-21719c14099a85161ed5488a4c7b1e3db6611073.zip
markup-validator-21719c14099a85161ed5488a4c7b1e3db6611073.tar.gz
markup-validator-21719c14099a85161ed5488a4c7b1e3db6611073.tar.bz2
Don't bother with gzipping HTML5 validator traffic if it seems to be installed locally.
-rwxr-xr-xhttpd/cgi-bin/check15
1 files changed, 11 insertions, 4 deletions
diff --git a/httpd/cgi-bin/check b/httpd/cgi-bin/check
index 8f519a3..0cf6ca6 100755
--- a/httpd/cgi-bin/check
+++ b/httpd/cgi-bin/check
@@ -14,7 +14,7 @@
# This source code is available under the license at:
# http://www.w3.org/Consortium/Legal/copyright-software
#
-# $Id: check,v 1.750 2009-12-12 12:47:19 ville Exp $
+# $Id: check,v 1.751 2009-12-12 20:06:36 ville Exp $
#
# We need Perl 5.8.0+.
@@ -197,7 +197,7 @@ EOF
#
# Strings
- $VERSION = q$Revision: 1.750 $;
+ $VERSION = q$Revision: 1.751 $;
$VERSION =~ s/Revision: ([\d\.]+) /$1/;
# Read friendly error message file
@@ -1213,8 +1213,15 @@ sub html5_validate (\$)
# formatted string).
$req->header('Last-Modified', $File->{Modified}) if $File->{Modified};
- # If not in debug mode, gzip the request (LWP >= 5.817)
- eval { $req->encode("gzip"); } unless $File->{Opt}->{Debug};
+ # Use gzip in non-debug, remote HTML5 validator mode (LWP >= 5.817).
+ if (!$File->{Opt}->{Debug} &&
+ $url->host() !~ /^(?:localhost|127(?:\.\d+){3}|.*\.localdomain)$/i)
+ {
+ eval { $req->encode("gzip"); };
+ }
+ else {
+ $req->header('Accept-Encoding', 'identity');
+ }
my $res = $ua->request($req);
if (!$res->is_success()) {