Summary: | LanguagePriority and DefaultLanguage are Case Sensitive at Content Negotiation | ||
---|---|---|---|
Product: | Apache httpd-2 | Reporter: | Allan Dyer <bugzilla> |
Component: | mod_negotiation | Assignee: | Apache HTTPD Bugs Mailing List <bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | calestyo, imacat |
Priority: | P2 | ||
Version: | 2.4.10 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux |
Description
Allan Dyer
2006-06-06 04:45:30 UTC
Hi. This is imacat from Taiwan. I wonder why there is no answer or update to this bug yet for more than 9 months. I fould that not only LanguagePriority, but DefaultLanguage is also case-sensitive, too. But they shouldn't, since (1) Apache documentation did not state it in any place, (2) ISO-636 Language Codes themselves are not case-sensitive. The following console log demostrate this bug. The only difference of httpd-lc.conf and httpd-uc.conf is that in httpd-lc.conf LanguagePriority and DefaultLanguage specify language in different cases, while in httpd-uc.conf they are the same. Please tell me if you need any more information, or if I can be of any help. Thank you. ====================== imacat@rinse ~ % ls /tmp/apache/htdocs page.html page.xhtml imacat@rinse ~ % cat /tmp/apache/htdocs/page.html This is page.html. imacat@rinse ~ % cat /tmp/apache/htdocs/page.xhtml This is page.xhtml. You have new mail. imacat@rinse ~ % cat /tmp/apache/httpd-lc.conf User nobody Group nogroup ServerName localhost ServerAdmin webmaster@localhost ServerRoot /tmp/apache DocumentRoot /tmp/apache/htdocs PidFile /tmp/apache/httpd.pid LoadModule mime_module /usr/lib/apache2/mod_mime.so LoadModule negotiation_module /usr/lib/apache2/mod_negotiation.so Listen 50080 ErrorLog /tmp/apache/error_log Options +MultiViews AddType application/xhtml+xml .xhtml AddType text/html .html ForceLanguagePriority Prefer Fallback LanguagePriority zh-TW DefaultLanguage zh-tw imacat@rinse ~ % /usr/sbin/httpd -f /tmp/apache/httpd-lc.conf imacat@rinse ~ % telnet localhost 50080 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET /page HTTP/1.1 Host: localhost Accept-Language: en Connection: close HTTP/1.1 406 Not Acceptable Date: Fri, 16 Mar 2007 14:40:19 GMT Server: Apache/2.2.4 (Unix) Alternates: {"page.html" 1 {type text/html} {language zh-tw} {length 19}}, {"page.xhtml" 1 {type application/xhtml+xml} {language zh-tw} {length 20}} Vary: negotiate,accept TCN: list Content-Length: 452 Connection: close Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>406 Not Acceptable</title> </head><body> <h1>Not Acceptable</h1> <p>An appropriate representation of the requested resource /page could not be found on this server.</p> Available variants: <ul> <li><a href="page.html">page.html</a> , type text/html, language zh-tw</li> <li><a href="page.xhtml">page.xhtml</a> , type application/xhtml+xml, language zh-tw</li> </ul> </body></html> Connection closed by foreign host. imacat@rinse ~ % kill $(<//tmp/apache/httpd.pid) imacat@rinse ~ % cat /tmp/apache/httpd-uc.conf User nobody Group nogroup ServerName localhost ServerAdmin webmaster@localhost ServerRoot /tmp/apache DocumentRoot /tmp/apache/htdocs PidFile /tmp/apache/httpd.pid LoadModule mime_module /usr/lib/apache2/mod_mime.so LoadModule negotiation_module /usr/lib/apache2/mod_negotiation.so Listen 50080 ErrorLog /tmp/apache/error_log Options +MultiViews AddType application/xhtml+xml .xhtml AddType text/html .html ForceLanguagePriority Prefer Fallback LanguagePriority zh-TW DefaultLanguage zh-TW imacat@rinse ~ % /usr/sbin/httpd -f /tmp/apache/httpd-uc.conf imacat@rinse ~ % telnet localhost 50080 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET /page HTTP/1.1 Host: localhost Accept-Language: en Connection: close HTTP/1.1 200 OK Date: Fri, 16 Mar 2007 14:40:33 GMT Server: Apache/2.2.4 (Unix) Content-Location: page.html Vary: negotiate,accept TCN: choice Last-Modified: Fri, 16 Mar 2007 14:32:44 GMT ETag: "2a955c-13-42bcc1cd6bb00;42bcc1b870980" Accept-Ranges: bytes Content-Length: 19 Connection: close Content-Type: text/html Content-Language: zh-TW This is page.html. Connection closed by foreign host. imacat@rinse ~ % kill $(<//tmp/apache/httpd.pid) imacat@rinse ~ % 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. I have re-tested this bug using the latest version of Apache I have available: apache2 -v Server version: Apache/2.4.10 (Debian) Server built: Mar 31 2018 10:14:07 The bug still exists as I described in my initial report. Confirming from RFC 7231 s3.1.1. that these tokens must be evaluated case-insensitive. Comment #0 is fixed in trunk in r1850989. Proposed for backport in r1851096 Backported in r1851468, ahead of the 2.4.38 release candidate tag. Only issue related to LanguagePriority reported in comment #0 has been fixed. Comment #1 is related to DefaultLanguage which seems to have the same issue. I've not investigated this 2nd issue. If you confirm that it is also fixed, feel free to re-RESOLVED/FIXED. Otherwise, I'll give it a look in the coming days. Although I haven't reviewed in-depth the case described in #1 above, a search of the sources for the ->default_language member (mime config) reveals no obvious string comparisons. This is simply a placeholder value of content-language in the absence of an explicit language override (e.g. language by file extension, typemap, etc.) I'm certain imacat's report reflects that the content-language resulting from the explicit DefaultLanguage directives was miscompared in the one by mod_negotiation. This ticket should remain closed absent a specific problem report with mod_negotiation. |