Evening!

I noticed that most of the time, when Apache httpd itself generates
HTML output (like for 404 pages and autoindex pages) it uses ancient
HTML 2.0 and HTML 3.2 doctypes.
These 11 attached diffs update those.  The most important of the diffs
is httpdh.diff
I compiled and tested these diffs, and everything I tested works fine!
 Browsers now render those pages in standards mode rather than quirks
mode.
While I made these patches for httpd 2.4.37 these patches would likely
also be useful for trunk.
This could be the first step in making sure all the HTML output is more valid.

Thank you for reading this email.
--- oldhttpd-2.4.37/modules/dav/main/mod_dav.h	2016-10-26 09:44:36.000000000 -0400
+++ httpd-2.4.37/modules/dav/main/mod_dav.h	2018-11-26 03:23:50.137651337 -0500
@@ -50,7 +50,7 @@
 
 #define DAV_READ_BLOCKSIZE      2048    /* used for reading input blocks */
 
-#define DAV_RESPONSE_BODY_1     "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>"
+#define DAV_RESPONSE_BODY_1	"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\";>\n<html>\n<head>\n<title>"
 #define DAV_RESPONSE_BODY_2     "</title>\n</head><body>\n<h1>"
 #define DAV_RESPONSE_BODY_3     "</h1>\n<p>"
 #define DAV_RESPONSE_BODY_4     "</p>\n"
--- oldhttpd-2.4.37/modules/generators/mod_autoindex.c	2017-05-02 07:01:17.000000000 -0400
+++ httpd-2.4.37/modules/generators/mod_autoindex.c	2018-11-26 02:46:14.181041720 -0500
@@ -179,7 +179,7 @@
                   " <head>\n  <title>Index of ", title,
                   "</title>\n", NULL);
     } else {
-        ap_rvputs(r, DOCTYPE_HTML_3_2,
+        ap_rvputs(r, DOCTYPE_HTML_4_01,
                   "<html>\n <head>\n"
                   "  <title>Index of ", title,
                   "</title>\n", NULL);
--- oldhttpd-2.4.37/include/httpd.h	2018-09-11 10:04:53.000000000 -0400
+++ httpd-2.4.37/include/httpd.h	2018-11-26 02:11:10.705996025 -0500
@@ -248,6 +248,10 @@
 #define DOCTYPE_HTML_4_0F "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
                           "DTD HTML 4.0 Frameset//EN\"\n" \
                           "\"http://www.w3.org/TR/REC-html40/frameset.dtd\";>\n"
+/** HTML 4.01 Doctype */
+#define DOCTYPE_HTML_4_01 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\";>\n"
+/** HTML 5 Doctype */
+#define DOCTYPE_HTML_5 "<!DOCTYPE html>\n"
 /** XHTML 1.0 Strict Doctype */
 #define DOCTYPE_XHTML_1_0S "<!DOCTYPE html PUBLIC \"-//W3C//" \
                            "DTD XHTML 1.0 Strict//EN\"\n" \
--- oldhttpd-2.4.37/modules/http/http_protocol.c	2018-09-11 10:04:53.000000000 -0400
+++ httpd-2.4.37/modules/http/http_protocol.c	2018-11-26 02:36:03.926389192 -0500
@@ -1528,7 +1528,7 @@
          */
 
         ap_rvputs_proto_in_ascii(r,
-                  DOCTYPE_HTML_2_0
+                  DOCTYPE_HTML_4_01
                   "<html><head>\n<title>", title,
                   "</title>\n</head><body>\n<h1>", h1, "</h1>\n",
                   NULL);
--- oldhttpd-2.4.37/docs/docroot/index.html	2007-06-11 14:53:14.000000000 -0400
+++ httpd-2.4.37/docs/docroot/index.html	2018-11-26 03:11:41.006265648 -0500
@@ -1 +1,11 @@
-<html><body><h1>It works!</h1></body></html>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd";>
+<HTML>
+<!-- In the above line, you can add a language tag, like en for English.  To do so: <HTML lang="en"> -->
+<HEAD>
+<!-- You should specify what encoding your HTML file uses.  If it were in UTF-8, you would put this element above this line: <META http-equiv="Content-Type" content="text/html; charset=utf-8"> -->
+<TITLE>Apache httpd root index</TITLE>
+</HEAD>
+<BODY>
+<P>It works!</P>
+</BODY>
+</HTML>
--- oldhttpd-2.4.37/modules/proxy/mod_proxy_balancer.c	2018-09-11 07:57:19.000000000 -0400
+++ httpd-2.4.37/modules/proxy/mod_proxy_balancer.c	2018-11-26 02:53:58.395124050 -0500
@@ -1603,7 +1603,7 @@
     }
     else {
         ap_set_content_type(r, "text/html; charset=ISO-8859-1");
-        ap_rputs(DOCTYPE_HTML_3_2
+        ap_rputs(DOCTYPE_HTML_4_01
                  "<html><head><title>Balancer Manager</title>\n", r);
         ap_rputs("<style type='text/css'>\n"
                  "table {\n"
--- oldhttpd-2.4.37/modules/proxy/mod_proxy_ftp.c	2018-02-13 18:43:36.000000000 -0500
+++ httpd-2.4.37/modules/proxy/mod_proxy_ftp.c	2018-11-26 02:52:04.750782214 -0500
@@ -524,7 +524,7 @@
 
         /* print "ftp://host/"; */
         escpath = ap_escape_html(p, path);
-        str = apr_psprintf(p, DOCTYPE_HTML_3_2
+        str = apr_psprintf(p, DOCTYPE_HTML_4_01
                 "<html>\n <head>\n  <title>%s%s%s</title>\n"
                 "<base href=\"%s%s%s\">\n"
                 " </head>\n"
--- oldhttpd-2.4.37/modules/mappers/mod_imagemap.c	2015-12-29 11:26:41.000000000 -0500
+++ httpd-2.4.37/modules/mappers/mod_imagemap.c	2018-11-26 02:50:02.831152465 -0500
@@ -477,7 +477,7 @@
 {
     ap_set_content_type(r, "text/html; charset=ISO-8859-1");
 
-    ap_rvputs(r, DOCTYPE_HTML_3_2, "<html><head>\n<title>Menu for ",
+    ap_rvputs(r, DOCTYPE_HTML_4_01, "<html><head>\n<title>Menu for ",
               ap_escape_html(r->pool, r->uri),
               "</title>\n</head><body>\n", NULL);
 
--- oldhttpd-2.4.37/modules/examples/mod_example_hooks.c	2016-02-09 18:09:24.000000000 -0500
+++ httpd-2.4.37/modules/examples/mod_example_hooks.c	2018-11-26 02:42:28.417980763 -0500
@@ -1006,7 +1006,7 @@
      * Now send our actual output.  Since we tagged this as being
      * "text/html", we need to embed any HTML.
      */
-    ap_rputs(DOCTYPE_HTML_3_2, r);
+    ap_rputs(DOCTYPE_HTML_4_01, r);
     ap_rputs("<HTML>\n", r);
     ap_rputs(" <HEAD>\n", r);
     ap_rputs("  <TITLE>mod_example_hooks Module Content-Handler Output\n", r);
--- oldhttpd-2.4.37/modules/ldap/util_ldap.c	2018-02-20 08:02:54.000000000 -0500
+++ httpd-2.4.37/modules/ldap/util_ldap.c	2018-11-26 02:39:31.399942241 -0500
@@ -130,7 +130,7 @@
     if (r->header_only)
         return OK;
 
-    ap_rputs(DOCTYPE_HTML_3_2
+    ap_rputs(DOCTYPE_HTML_4_01
              "<html><head><title>LDAP Cache Information</title></head>\n", r);
     ap_rputs("<body bgcolor='#ffffff'><h1 align=center>LDAP Cache Information"
              "</h1>\n", r);
--- oldhttpd-2.4.37/modules/generators/mod_status.c	2018-09-18 17:08:10.000000000 -0400
+++ httpd-2.4.37/modules/generators/mod_status.c	2018-11-26 02:47:15.874112353 -0500
@@ -412,7 +412,7 @@
     ap_get_loadavg(&t);
 
     if (!short_report) {
-        ap_rputs(DOCTYPE_HTML_3_2
+        ap_rputs(DOCTYPE_HTML_4_01
                  "<html><head>\n"
                  "<title>Apache Status</title>\n"
                  "</head><body>\n"

Reply via email to