Bug 44218

Summary: mod_autoindex shows the default icon for files with a content encoding, rather than the icon configured for the content type
Product: Apache httpd-2 Reporter: Jon Severinsson <jon>
Component: mod_autoindexAssignee: Apache HTTPD Bugs Mailing List <bugs>
Severity: minor Keywords: MassUpdate
Priority: P2    
Version: 2.2.6   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: My mod_mime configuration
My mod_autoindex configuration
Find the icon (item) by checking the directive value first
make sure that by encoding can override by type

Description Jon Severinsson 2008-01-13 01:08:59 UTC
First some background:
I'm using www-servers/apache-2.2.6-r5 from Gentoo portage.

I have configured mod_mime to serve both .svg and .svgz files as "Content-Type:
image/svg+xml", but to add "Content-Encoding: x-gzip" to .svgz files. The
headers are served correctly to clients (checked with wget -S).

I have configured mod_autoindex to use image-svg+xml.png as icon for
image/svg+xml and unknown.png as DefaultIcon. There is no single
AddIconByEncoding directive in my configuration files.

Now to my problem:
In directory listings all .svg file gets image-svg+xml.png as icon, but all
.svgz files gets unknown.png, even though it has the correct content-type.

I'm also having the same problem with .tar.gz, .tar.bz2, .xcf.gz and xcf.bz2,
even though they get served with the correct content type, and .tar and .xcf
files work. In fact, I have not found a single file with a content-encoding that
gets the correct icon, they all get unknown.png.
Comment 1 Jon Severinsson 2008-01-13 01:10:15 UTC
Created attachment 21379 [details]
My mod_mime configuration
Comment 2 Jon Severinsson 2008-01-13 01:10:51 UTC
Created attachment 21380 [details]
My mod_autoindex configuration
Comment 3 rahul 2008-09-05 05:08:58 UTC
confirmed in trunk (solaris 11 sparc)
Comment 4 rahul 2008-09-05 06:24:24 UTC
Created attachment 22528 [details]
Find the icon (item) by checking the directive value first
Comment 5 William A. Rowe Jr. 2008-09-05 12:31:58 UTC
I believe the patch is wrong.  If icons-by-encoding are present they should
override icons-by-type.  However, you were right that the existing code was
borked.  I believe the logic should be starting with a stanza;

if (content_encoding && p->type == BY_ENCODING)

and continue from there.
Comment 6 rahul 2008-09-06 03:22:53 UTC
(In reply to comment #5)
> I believe the patch is wrong.  If icons-by-encoding are present they should
> override icons-by-type.

- I couldn't find the weights of each (path|type|encoding) in the documentation so I assumed the the order of directives mattered.
- will update the patch.
Comment 7 rahul 2008-09-08 04:51:40 UTC
Created attachment 22539 [details]
make sure that by encoding can override by type

Also cleaned up the logic a little bit and added some comments.
Comment 8 Rainer Jung 2018-02-25 21:09:51 UTC
Undo spam change
Comment 9 William A. Rowe Jr. 2018-11-07 21:08:31 UTC
Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated.