httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/modules/mappers mod_negotiation.c
Date Wed, 13 Feb 2002 02:55:17 GMT
wrowe       02/02/12 18:55:17

  Modified:    modules/mappers mod_negotiation.c
  Log:
    Address the issue raised on list that users with a LanguagePriority
    directive alone expect 'ForceLanguagePriority Prefer' behavior even
    if that directive is omitted.
  
  Revision  Changes    Path
  1.95      +18 -9     httpd-2.0/modules/mappers/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_negotiation.c,v
  retrieving revision 1.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- mod_negotiation.c	29 Jan 2002 17:46:30 -0000	1.94
  +++ mod_negotiation.c	13 Feb 2002 02:55:17 -0000	1.95
  @@ -94,11 +94,13 @@
   
   /* forcelangpriority flags 
    */
  -#define FLP_UNDEF    0    /* Same as FLP_NONE, but base overrides */
  +#define FLP_UNDEF    0    /* Same as FLP_DEFAULT, but base overrides */
   #define FLP_NONE     1    /* Return 406, HTTP_NOT_ACCEPTABLE */
   #define FLP_PREFER   2    /* Use language_priority rather than MC */
   #define FLP_FALLBACK 4    /* Use language_priority rather than NA */
   
  +#define FLP_DEFAULT  FLP_PREFER
  +
   module AP_MODULE_DECLARE_DATA negotiation_module;
   
   static void *create_neg_dir_config(apr_pool_t *p, char *dummy)
  @@ -117,10 +119,12 @@
       neg_dir_config *new = (neg_dir_config *) apr_palloc(p, sizeof(neg_dir_config));
   
       /* give priority to the config in the subdirectory */
  -    new->forcelangpriority = add->forcelangpriority ? add->forcelangpriority
  -                                                    : base->forcelangpriority;
  -    new->language_priority = add->language_priority ? add->language_priority 
  -                                                    : base->language_priority;
  +    new->forcelangpriority = (add->forcelangpriority != FLP_UNDEF)
  +				? add->forcelangpriority 
  +				: base->forcelangpriority;
  +    new->language_priority = add->language_priority 
  +				? add->language_priority 
  +                                : base->language_priority;
       return new;
   }
   
  @@ -1467,6 +1471,11 @@
   
   static void set_language_quality(negotiation_state *neg, var_rec *variant)
   {
  +    int forcepriority = neg->conf->forcelangpriority;
  +    if (forcepriority == FLP_UNDEF) {
  +        forcepriority = FLP_DEFAULT;
  +    }
  +
       if (!variant->content_languages || !variant->content_languages->nelts) {
           /* This variant has no content-language, so use the default
            * quality factor for variants with no content-language
  @@ -1620,9 +1629,9 @@
        * to LanguagePriority order.  The best match is the lowest index of 
        * any LanguagePriority match.
        */
  -    if (((neg->conf->forcelangpriority & FLP_PREFER) 
  +    if (((forcepriority & FLP_PREFER) 
                && (variant->lang_index < 0))
  -     || ((neg->conf->forcelangpriority & FLP_FALLBACK)
  +     || ((forcepriority & FLP_FALLBACK)
                && !variant->lang_quality)) 
       {
           int bestidx = -1;
  @@ -1647,12 +1656,12 @@
   
           if (bestidx >= 0) {
               if (variant->lang_quality) {
  -                if (neg->conf->forcelangpriority & FLP_PREFER) {
  +                if (forcepriority & FLP_PREFER) {
                       variant->lang_index = bestidx;
                   }
               }
               else {
  -                if (neg->conf->forcelangpriority & FLP_FALLBACK) {
  +                if (forcepriority & FLP_FALLBACK) {
                       variant->lang_index = bestidx;
                       variant->lang_quality = .0001f;
                       variant->definite = 0;
  
  
  

Mime
View raw message