fielding 97/03/24 14:07:08
Modified: src CHANGES mod_negotiation.c Log: If charset quality of current variant and best variant is equal and the best variant is in ISO-8859-1, then prefer current variant. Submitted by: Petr Lampa Reviewed by: Roy Fielding and Dean Gaudet Revision Changes Path 1.210 +5 -2 apache/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache/src/CHANGES,v retrieving revision 1.209 retrieving revision 1.210 diff -C3 -r1.209 -r1.210 *** CHANGES 1997/03/22 23:51:00 1.209 --- CHANGES 1997/03/24 22:07:05 1.210 *************** *** 56,68 **** *) Try to continue gracefully by disabling the vhost if a DNS lookup fails while parsing the configuration file. [Dean Gaudet] ! *) Workaround to a compiler bug that causes SunOS 4.1.x to panic. ! [Roy Fielding] *) Negotiation changes: Don't output empty content-type in variant list; Output charset in variant list; Return sooner from handle_multi() if no variants found; Add handling of '*' wildcard in Accept-Charset. [Petr Lampa and Paul Sutton] *) Memory allocation problem in push_array() -- it would corrupt memory when nalloc==0. [Kai Risku <[EMAIL PROTECTED]> and Roy Fielding] --- 56,71 ---- *) Try to continue gracefully by disabling the vhost if a DNS lookup fails while parsing the configuration file. [Dean Gaudet] ! *) Improved calls to setsockopt. [Roy Fielding] *) Negotiation changes: Don't output empty content-type in variant list; Output charset in variant list; Return sooner from handle_multi() if no variants found; Add handling of '*' wildcard in Accept-Charset. [Petr Lampa and Paul Sutton] + + *) If two variants' charset quality are equal and one is the default + charset (iso-8859-1), then prefer the variant that was specifically + listed in Accept-Charset instead of the default. [Petr Lampa] *) Memory allocation problem in push_array() -- it would corrupt memory when nalloc==0. [Kai Risku <[EMAIL PROTECTED]> and Roy Fielding] 1.37 +16 -1 apache/src/mod_negotiation.c Index: mod_negotiation.c =================================================================== RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C3 -r1.36 -r1.37 *** mod_negotiation.c 1997/03/18 09:46:28 1.36 --- mod_negotiation.c 1997/03/24 22:07:06 1.37 *************** *** 1432,1437 **** --- 1432,1447 ---- *p_bestq = q; return 1; } + if (q == bestq) { + /* If the best variant's charset is ISO-8859-1 and this variant has + the same charset quality, then we prefer this variant */ + if (variant->charset_quality == best->charset_quality && + (best->content_charset == NULL || *best->content_charset == 0 || + strcmp(best->content_charset, "iso-8859-1") == 0)) { + *p_bestq = q; + return 1; + } + } return 0; } *************** *** 1522,1528 **** /* charset */ if (variant->charset_quality < best->charset_quality) return 0; ! if (variant->charset_quality > best->charset_quality) { *p_bestq = q; return 1; } --- 1532,1543 ---- /* charset */ if (variant->charset_quality < best->charset_quality) return 0; ! /* If the best variant's charset is ISO-8859-1 and this variant has ! the same charset quality, then we prefer this variant */ ! if (variant->charset_quality > best->charset_quality || ! (variant->charset_quality == best->charset_quality && ! (best->content_charset == NULL || *best->content_charset == 0 || ! strcmp(best->content_charset, "iso-8859-1") == 0))) { *p_bestq = q; return 1; }