Bug 43649

Summary: mod_autoindex is generating invalid XHTML markup
Product: Apache httpd-2 Reporter: Jose Kahan <jose>
Component: mod_autoindexAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: REOPENED ---    
Severity: trivial    
Priority: P2    
Version: 2.2.21   
Target Milestone: ---   
Hardware: PC   
OS: FreeBSD   
Attachments: mod_autoindex was not adding the xhtml namespace
mod_autoindex was not adding the xhtml namespace

Description Jose Kahan 2007-10-18 08:11:12 UTC
mod_autoindex is generating invalid XHTML markup. The xhtml namespace was 
missing in emit_preamble(). I'm including a patch against both 2.2.6 and trunk 
that fixes it.

Bug report 34519 is quite similar, but mentions other enhancements (and didn't 
include a patch). I decided to make a new bug report as I was not sure if it 
was OK to reply to one of the points given in the previous report.
Comment 1 Jose Kahan 2007-10-18 08:12:32 UTC
Created attachment 21003 [details]
mod_autoindex was not adding the xhtml namespace

Patch against 2.2.6
Comment 2 Jose Kahan 2007-10-18 08:12:56 UTC
Created attachment 21004 [details]
mod_autoindex was not adding the xhtml namespace

Patch against trunk
Comment 3 Ruediger Pluem 2007-11-10 14:16:52 UTC
Committed to trunk as r59381 (http://svn.apache.org/viewvc?rev=593778&view=rev).
Thanks for the patch.
Comment 4 Ruediger Pluem 2007-11-10 14:22:49 UTC
Proposed for backport as r593818 (http://svn.apache.org/viewvc?rev=593818&view=rev).
Comment 5 Ted Guild 2007-11-13 15:43:56 UTC
Here's an idea:

These autoindexes should not only be valid markup but promote open standards
(valid markup) by linking back to W3C's Validator.  If you are open to the idea
it would be ideal if Apache were to include W3C valid markup logos in the /icons
directory so as to distribute load of serving those icons on all the new valid
autoindex URIs.

In turn we can promote adoption of Apache 2.2, as apparently many are still 1.3,
on the Validator's results page eg  

http://validator.w3.org/check?uri=http%3A//www.w3.org/&doctype=Inline&%20outline=

We could give an alternate markup for Apache instances >2.2.N to all users or
perhaps just for sites we detect the Server: header as still Apache 1.3 or 2.0

  <p>
    <a href="http://validator.w3.org/check?uri=referer"><img
        src="/icons/valid-xhtml10"
        alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a>
  </p>
Comment 6 André Malo 2007-11-14 13:36:24 UTC
I don't like it.
Comment 7 Takashi Sato 2007-11-20 15:28:16 UTC
to 2.2 as r596675
<http://svn.apache.org/viewvc?view=rev&revision=596675>
Comment 8 Adam Gabryś 2012-01-02 21:28:36 UTC
mod_autoindex is generating invalid XHTML 1.0 Transitional for fancy list.
Configuration:
IndexOptions Charset=utf-8 XHTML FancyIndexing FoldersFirst VersionSort
IndexHeadInsert "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />"

HeaderName secret.html
ReadmeName secret.html

There is problem with hr markups:
document type does not allow element "hr" here; missing one of "button", "ins", "del" start-tag

You can read it here: http://validator.w3.org/check?uri=http%3a%2f%2fgabrys.biz%2fimages%2f

Its should be outside pre markup. They are created in lines 1603-1608 and 1814-1819. Problem can be solved with replece specifed lines:
1604 -> ap_rputs("</pre><hr", r);
1608 -> ap_rputs("><pre>", r);
insert ap_rputs("</pre>\n", r); under 1813
1819 ap_rputs(">\n", r);
delete 1821, 1822, 1823

I don't test it, because I am a new FreeBSD and Apache user, and I not able to do a lot of things now :/