!

I'm not sure if I should mail this here or open a
new bugzilla report. Please advice.

The Content Negotiation doc is using a misleading
example in this section:

 http://httpd.apache.org/docs/2.2/content-negotiation.html#better

[[
 Example

 SetEnvIf Cookie "language=(.+)" prefer-language=$1
 Header append Vary cookie
]]


That regular expression won't work if the cookie has other attributes
in addition to the language one. One of our users got caught
by it. A quick search on the web shows that many people have had
this problem too.

Here's a correct regular expression that will return the language
attribute value, regardless of the contents of the cookie:

[[
SetEnvIf Cookie "language=([a-z|A-Z][a-z|A-Z|-]+)" prefer-language=$1
]]

The expression looks bigger because it takes into account not
only strings like "en", but also "zh-hans". I added upper and lower
case as cookies are case insensitive and I'm not sure if Apache converts
cookies to lower-case at some point. If it's always lower case,
we can simplify the regular expression to:

[[
SetEnvIf Cookie "language=([a-z][a-z|-]+)" prefer-language=$1
]]


Could you update the example in the doc accordingly?

Thanks!

-jose

Reply via email to