On Sun, Feb 10, 2002 at 12:02:18PM -0500, Joshua Slive wrote:
> The config files are wrong; they should have ForceLanguagePriority.

rbb and I agree that "ForceLanguagePriority Prefer Fallback" should
be the default.  It defaults to "None" right now.

OtherBill added this a few months ago (?) when he did some changes
to mod_negotiation.  He *did* add "Prefer Fallback" to the 
httpd-std.conf files, so it's obvious he intended this to be the
default.  No one updated daedalus to match.  As I tried to show,
just by adding "ForceLanguagePriority Prefer Fallback" to docs-2.0
fixes our problem.

> BUT... This does not explain the problem.  In the absence of
> ForceLanguagePriority, apache should do the following:

Well, taking a look at the code, I'm not entirely sure we're
doing the wrong thing.

I believe OtherBill was trying to ensure that we could never
return the "wrong" thing unless the admin told us otherwise.
Previously, we would return .html as the best language.  That's
a complete and total hack that we *must* get rid of.  It was the
wrong thing to do.

This is how I see it:

Prefer is used to avoid cases where we would send
MULTIPLE_CHOICES or we do not have enough information to
make a good determination about which language to use.  So, 
we'll use LanguagePriority to determine what is best.  (As
we'll see in a second, otherwise, we'll use C-L to determine
the best variant.)

Fallback is used when we have no acceptable variants listed
that match and would return NOT_ACCEPTABLE.  We'll try to
have a "fallback" choice to prevent that from occurring.
Again, we'll use LanguagePriority to determine the "best"
choice.

> 1) If no Accept-Language: Use LanguagePriority.

In this case, this is only used when "ForceLanguagePriority" is
set to Prefer.  Look at mod_negotiation.c:set_language_quality().
On browsers that don't send Accept-Language headers, we can't
use any heuristics, so we avoid making any determination as to
the quality of the variant.  However, we have a failsafe here:
"Prefer" in ForceLanguagePriority.

If "ForceLanguagePriority" is set to Prefer and we haven't computed
its language priority (and in the case of no Accept-Language we
definitely haven't set lang_index), we'll go through and compute
lang_index based on LanguagePriority listed in httpd.conf.

When we go through all variants in best_match() and call
is_variant_better(), one of the factors is lang_index.  However,
if Prefer isn't set and we didn't receive Accept-Language, lang_index
is -1 for *all* variants.  So, they would all match.  And, indeed,
with our manuals, that is really the only distinction we have
available when we don't have an Accept-Language.  Therefore, the
determining factor once again is content-length.  And, french has
the smallest size of all the docs:

jerenkrantz@daedalus% ls -l /www/httpd.apache.org/docs/index.html.*
-rw-rw-r--  1 slive   httpd  9266 Dec  2 11:46 index.html.en
-rw-r--r--  1 rbowen  httpd  8603 Oct  7 18:41 index.html.fr
-rw-r--r--  1 rbowen  httpd   156 Oct  7 18:41 index.html.html
-rw-rw-r--  1 slive   httpd  9504 Dec 30 08:07 index.html.ja.jis

(Notice our friend .html.html which has been relegated to outcast.)

jerenkrantz@daedalus% ls -l /www/httpd.apache.org/docs-2.0/index.html*
-rw-rw-r--  1 slive     httpd  9334 Dec  3 10:38 index.html.en
-rw-rw-r--  1 jwoolley  httpd  8223 Sep 22 17:29 index.html.fr
-rw-rw-r--  1 slive     httpd  5614 Dec 13 13:42 index.html.ja.jis

(See why Japanese would be returned for Apache 2.0 docs, but I
added FLP to the .htaccess file on daedalus, so we'll respect
LangPriority.)

> 2) If Accept-Language doesn't match with available language: Return "No
> Acceptable Variant".

I believe this could occur if Accept-Language is sent.  In the
cases we're seeing, that's not the case as no Accept-Language is
sent.  And, indeed, this is what Fallback is for.  Fallback should
deal with the case that we don't want to return HTTP_NOT_ACCEPTABLE
if their Accept-Language doesn't match.

> So we shouldn't just patch httpd.conf.  We need to figure out what is
> going wrong.

I believe nothing is wrong.

I believe it is working as intended.  Fix the config file, and
move on.  I will attempt to commit a change that makes PREFER
and FALLBACK the default for ForceLangPriority in the code, but
I'm not sure when I'll be able to commit that.  OtherBill may
beat me to that.  (I believe he is taking a well-deserved
vacation this weekend.)  -- justin

Reply via email to