akosut      96/08/15 12:27:00

  Modified:    src       mod_negotiation.c
  Log:
  Make language subtag matching work in both directions correctly.
  
  Revision  Changes    Path
  1.14      +6 -2      apache/src/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -C3 -r1.13 -r1.14
  *** mod_negotiation.c 1996/08/15 19:22:38     1.13
  --- mod_negotiation.c 1996/08/15 19:26:59     1.14
  ***************
  *** 761,767 ****
    
    /* Finding languages.  Note that we only match the substring specified
     * by the Accept: line --- this is to allow "en" to match all subvariants
  !  * of English.
     *
     * Again, strcmp() is legit because we've ditched case already.
     */
  --- 761,768 ----
    
    /* Finding languages.  Note that we only match the substring specified
     * by the Accept: line --- this is to allow "en" to match all subvariants
  !  * of English. We then do it in the other direction, so that all
  !  * subvariants of English match "en".
     *
     * Again, strcmp() is legit because we've ditched case already.
     */
  ***************
  *** 776,784 ****
    
        accs = (accept_rec *)accept_langs->elts;
    
  !     for (i = 0; i < accept_langs->nelts; ++i)
        if (!strncmp (lang, accs[i].type_name, strlen(accs[i].type_name)))
            return i;
            
        return -1;              
    }
  --- 777,788 ----
    
        accs = (accept_rec *)accept_langs->elts;
    
  !     for (i = 0; i < accept_langs->nelts; ++i) {
        if (!strncmp (lang, accs[i].type_name, strlen(accs[i].type_name)))
            return i;
  +     if (!strncmp (lang, accs[i].type_name, strlen(lang)))
  +         return i;
  +     }
            
        return -1;              
    }
  
  
  

Reply via email to