tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject RE: svn commit: r469665 - /tomcat/connectors/trunk/jk/native/common/jk_map.c
Date Tue, 31 Oct 2006 23:11:49 GMT
 

> -----Original Message-----
> From: rjung@apache.org [mailto:rjung@apache.org] 
> Sent: Tuesday, October 31, 2006 1:42 PM
> To: tomcat-dev@jakarta.apache.org
> Subject: svn commit: r469665 - 
> /tomcat/connectors/trunk/jk/native/common/jk_map.c
> 
> Author: rjung
> Date: Tue Oct 31 13:41:45 2006
> New Revision: 469665
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=469665
> Log:
> Fix for BZ 40856:
> 
> When mapping URLs we use case sensitive comparisons since 
> version 1.2.19.
> Unfortunately when adding mappings, we only add an entry,
> if there is no other entry with the same URL with case 
> insensitive comparison.
> So whenever multiple URLs are being mapped, which only differ by case,
> we add onyl one mapping for the first of those URLs, but it's 
> value will
> be the worker for the last mapping.
> 
> This was the last remaining place, where we used case 
> insensitive comparisons
> on the key side of mappings. All other such comparisons are 
> for values.
> Since al jk_map_get methods were already case sensitive and we never
> change the case when adding entries, it should be save to 
> drop the case insensitive
> key match when adding.
> 
> So now keys are always case sensitive, as a result, we shouldn't apply
> the case mask when calculating the checksum.
> 
> Modified:
>     tomcat/connectors/trunk/jk/native/common/jk_map.c
> 
> Modified: tomcat/connectors/trunk/jk/native/common/jk_map.c
> URL: 
> http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native
> /common/jk_map.c?view=diff&rev=469665&r1=469664&r2=469665
> ==============================================================
> ================
> --- tomcat/connectors/trunk/jk/native/common/jk_map.c (original)
> +++ tomcat/connectors/trunk/jk/native/common/jk_map.c Tue Oct 
> 31 13:41:45 2006
> @@ -36,17 +36,11 @@
>  #define JK_MAP_REFERENCE    (".reference")
>  #define JK_MAP_REFERENCE_SZ (strlen(JK_MAP_REFERENCE))
>  
> -#ifdef AS400
> -#define CASE_MASK 0xbfbfbfbf
> -#else
> -#define CASE_MASK 0xdfdfdfdf
> -#endif
> -
>  /* Compute the "checksum" for a key, consisting of the first
> - * 4 bytes, normalized for case-insensitivity and packed into
> - * an int...this checksum allows us to do a single integer
> + * 4 bytes, packed into an int.
> + * This checksum allows us to do a single integer
>   * comparison as a fast check to determine whether we can
> - * skip a strcasecmp
> + * skip a strcmp
>   */
>  #define COMPUTE_KEY_CHECKSUM(key, checksum)    \
>  {                                              \
> @@ -68,7 +62,6 @@
>          c = (unsigned int)*++k;                \
>          checksum |= c;                         \
>      }                                          \
> -    checksum &= CASE_MASK;                     \
>  }

This isn't very safe on machines that care about alignment (e.g. Sparc) :(.

>  
>  struct jk_map
> @@ -343,7 +336,7 @@
>          unsigned int key;
>          COMPUTE_KEY_CHECKSUM(name, key)
>          for (i = 0; i < m->size; i++) {
> -            if (m->keys[i] == key && strcasecmp(m->names[i], 
> name) == 0) {
> +            if (m->keys[i] == key && strcmp(m->names[i], 
> name) == 0) {
>                  break;
>              }
>          }
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 
> 
> 



This message is intended only for the use of the person(s) listed above as the intended recipient(s),
and may contain information that is PRIVILEGED and CONFIDENTIAL.  If you are not an intended
recipient, you may not read, copy, or distribute this message or any attachment. If you received
this communication in error, please notify us immediately by e-mail and then delete all copies
of this message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through the Internet
is not secure. Do not send confidential or sensitive information, such as social security
numbers, account numbers, personal identification numbers and passwords, to us via ordinary
(unencrypted) e-mail.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message