]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Docs: fancy up ERR_INVALID_REQ with some javascript
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 24 May 2011 05:33:47 +0000 (17:33 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 24 May 2011 05:33:47 +0000 (17:33 +1200)
Some of the "possible problems" can be determined as not-relevant.
When these cases are detected hide the text from viewers in a way that
keeps the page operational when javascript is disabled.

errors/templates/ERR_INVALID_REQ

index 7ec7e9179b7e8a25539ae99172436d1e4124dfc4..ea0482c16f56724994ec556cece7a046f819051c 100644 (file)
@@ -25,9 +25,9 @@ body
 
 <p>Some possible problems are:</p>
 <ul>
-<li><p>Missing or unknown request method.</p></li>
-<li><p>Missing URL.</p></li>
-<li><p>Missing HTTP Identifier (HTTP/1.0).</p></li>
+<li id="missing-method"><p>Missing or unknown request method.</p></li>
+<li id="missing-url"><p>Missing URL.</p></li>
+<li id="missing-protocol"><p>Missing HTTP Identifier (HTTP/1.0).</p></li>
 <li><p>Request is too large.</p></li>
 <li><p>Content-Length missing for POST or PUT requests.</p></li>
 <li><p>Illegal character in hostname; underscores are not allowed.</p></li>
@@ -38,6 +38,12 @@ body
 <br>
 </div>
 
+<script language="javascript">
+if ('%M' != '[unknown method]') document.getElementById('missing-method').style.display = 'none';
+if ('%u' != '[no URL]') document.getElementById('missing-url').style.display = 'none';
+if ('%P' != '[unknown protocol]') document.getElementById('missing-protocol').style.display = 'none';
+</script>
+
 <hr>
 <div id="footer">
 <p>Generated %T by %h (%s)</p>