[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#288615: Issue with language negotiation exceptions [kind-of patch]


just stopping by here on my search for a different bug...

As I read the docs (exactly the bit you quoted in the bug report!), Apache 
is behaving as described. However, its behaviour could be improved to be a 
bit more useful.

To the bug submitter: The only solution that I see for you ATM is to create 
symlinks for all language subsets that are important to you. For example, 
create a symlink called "index.fr-fr.html" which points to "index.fr.html".

To the maintainers:

The browser requests the languages "fr-fr,en-us;q=0.3", which is broken 
behaviour anyway as far as the HTTP standard is concerned; "fr" and 
"en;q=0.3" ought to be added.

When Apache sees that Accept-Language header, it cannot match it against 
the, say, index.en.html and index.fr.html files on disc. So the second part 
of the paragraph quoted in the bug report applies: The above list of 
language preferences is turned into


The order in this list does not matter, only the weight of each 
variant. So - oops: Suddenly fr and en have equal priority! :-(

At this point, the two available variants are in every practical aspect 
equally well-suited. Now the algorithm described on
will try to select one variant just to create a predictable, reproducible 
response. In our case, "en" sorts earlier alphabetically than "fr", so "en" 
is served.

The solution to this is: Do not use a quality value of 0.001 when adding 
the non-subset languages, but multiply the (implicit) 1.0 of fr-fr and the 
0.3 of en-us with 0.001.

Disclaimer: I'm not an Apache hacker, but having looked at the source for 
10 minutes, it appears the change would be inside set_language_quality() in 
modules/mappers/mod_negotiation.c. Instead of the line

  fiddle_q = 0.001f;
you'd want something similar to

  fiddle_q = 0.001f * accs[i].quality;

(completely untested)



  __   _
  |_) /|  Richard Atterer
  | \/¯|  http://geht.net.gibts.bei.atterer.net
  ¯ '` ¯

Reply to: