diff options
author | Guillaume Baudusseau <guibbs@users.noreply.github.com> | 2015-07-13 10:36:44 -0400 |
---|---|---|
committer | Guillaume Baudusseau <guibbs@users.noreply.github.com> | 2015-07-13 10:36:44 -0400 |
commit | 10dba8adcefff7da357ee61c8f570bad9bb74958 (patch) | |
tree | 48417f1fda27ed2312f975c62091448086efdb7b | |
parent | 65d7acda7482a3401bbff278c286f09bd8f8b03d (diff) | |
parent | 3785ea50e4da0c8f500d482772f13c121146f2a6 (diff) | |
download | markup-validator-10dba8adcefff7da357ee61c8f570bad9bb74958.zip markup-validator-10dba8adcefff7da357ee61c8f570bad9bb74958.tar.gz markup-validator-10dba8adcefff7da357ee61c8f570bad9bb74958.tar.bz2 |
Merge pull request #1 from w3c/sideshowbarker/request-reroute
Re-route HTML5 validator requests to Nu Checker.
-rwxr-xr-x | httpd/cgi-bin/check | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/httpd/cgi-bin/check b/httpd/cgi-bin/check index 75a52a9..258332c 100755 --- a/httpd/cgi-bin/check +++ b/httpd/cgi-bin/check @@ -1097,6 +1097,45 @@ sub html5_validate (\$) $req->header('Accept-Encoding', 'identity'); } + if ($File->{'Direct Input'}) { + print "Content-type: text/html\n\n"; + print "<!doctype html>"; + print "<style>.hide { display: none }</style>"; + print "<script>setTimeout('document.vnupost.submit()',0)</script>"; + print "<form name=vnupost method=post enctype=multipart/form-data action=https://validator.w3.org/nu/>"; + # for direct input, must always send vnu the showsource=yes option + print "<input type=hidden name=showsource value=yes>"; + if ($File->{Opt}->{Outline}) { + print "<input type=hidden name=showoutline value=yes>"; + } + if ($File->{Opt}->{Output} eq 'json') { + print "<input type=hidden name=out value=json>"; + } + print "<textarea id=doc name=content>"; + print $req->content; + print "</textarea>"; + print "<input type=submit>"; + print "</form>"; + print "<script>document.vnupost.className = 'hide'</script>"; + exit; + } elsif (!$File->{'Is Upload'}) { + my $uri = $File->{'URI'}; + my $source_option = ""; + my $outline_option = ""; + my $output_option = ""; + if ($File->{Opt}->{'Show Source'}) { + $source_option = "&showsource=yes"; + } + if ($File->{Opt}->{Outline}) { + $outline_option = "&showoutline=yes"; + } + if ($File->{Opt}->{Output} eq 'json') { + $output_option = "&out=json"; + } + print redirect + 'https://validator.w3.org/nu/?doc=' . uri_escape($uri) . + $source_option . $outline_option . $output_option; + } my $res = $ua->request($req); if (!$res->is_success()) { $File->{'Error Flagged'} = TRUE; |