You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2006/06/06 06:45:31 UTC

DO NOT REPLY [Bug 39730] New: - LanguagePriority is case sensitive, but not documented as such

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39730>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39730

           Summary: LanguagePriority is case sensitive, but not documented
                    as such
           Product: Apache httpd-2
           Version: 2.0.54
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: mod_negotiation
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: bugzilla@vampire.com.hk


I had difficulty in getting language negotiation working because I didn't
realise LanguagePriority was case sensitive... this is inconsistent with the
behaviour of AddLanguage.
(I found this in version 2.0.54, but I've looked through the latest CHANGES file
and not found anything indicating there has been a change on this)

My server configuration included:

AddLanguage en .en 
AddLanguage zh-TW .zh-TW 
AddLanguage zh-CN .zh-CN 
LanguagePriority en zh-TW zh-CN fr de it ja
ForceLanguagePriority Prefer Fallback

If a client preferred Chinese, but none was available, the English version was
served - seeing this, I thought it was working.

However, if the client preferred English and none was available, the "406 Not
Acceptable" error was returned instead of a Chinese version.

I changed the LanguagePriority directive to:
LanguagePriority en zh-tw zh-TW zh-cn zh-CN fr de it ja
and it worked in both cases. I conclude that the LanguagePriority directive does
case-sensitive matching.

Interestingly, the 406 error page included the text:

"Available variants:

    * haribo.html.zh-CN , type text/html, language zh-cn
    * haribo.html.zh-TW , type text/html, language zh-tw"

So the AddLanguage directive does fold the languge codes to lower case.

I suggest:
1. Add a note to the LanguagePriority directive documentation saying it is
case-sensitive

or

2. Change the behaviour of LanguagePriority so it is case-insensitive.

(2) would be preferable, and it matches the behaviour of AddLanguage.

Thanks.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 39730] - LanguagePriority and DefaultLanguage are Case Sensitive at Content Negotiation

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39730>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39730


imacat@mail.imacat.idv.tw changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |imacat@mail.imacat.idv.tw




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 39730] - LanguagePriority and DefaultLanguage are Case Sensitive at Content Negotiation

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39730>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39730


imacat@mail.imacat.idv.tw changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |normal
            Summary|LanguagePriority is case    |LanguagePriority and
                   |sensitive, but not          |DefaultLanguage are Case
                   |documented as such          |Sensitive at Content
                   |                            |Negotiation
            Version|2.0.54                      |2.2.4




------- Additional Comments From imacat@mail.imacat.idv.tw  2007-03-16 08:02 -------
    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 ~ %


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org