You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bi...@apache.org on 2004/07/15 05:37:01 UTC

cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c

billbarker    2004/07/14 20:37:01

  Modified:    jk/native/common jk_lb_worker.c
  Log:
  Fix the parsing of the Cookie so that PSJSESSIONID doesn't match.
  
  Also make the parsing a bit closer to RFC 2109
  
  Reported By: Sandy McArthur <Sa...@McArthur.org>
  
  Revision  Changes    Path
  1.18      +16 -8     jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c
  
  Index: jk_lb_worker.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- jk_lb_worker.c	24 Feb 2004 08:45:46 -0000	1.17
  +++ jk_lb_worker.c	15 Jul 2004 03:37:00 -0000	1.18
  @@ -122,15 +122,23 @@
               for(id_start = strstr(s->headers_values[i], name) ; 
                   id_start ; 
                   id_start = strstr(id_start + 1, name)) {
  -                if('=' == id_start[strlen(name)]) {
  -                    /*
  -                     * Session cookie was found, get it's value
  -                     */
  -                    id_start += (1 + strlen(name));
  -                    if(strlen(id_start)) {
  +                if(id_start == s->headers_values[i] ||
  +                   id_start[-1] == ';' ||
  +                   id_start[-1] == ',' ||
  +                   isspace(is_start[-1]) ) {
  +                    id_start += strlen(name);
  +                    while(*id_start && !isspace(*id_start))
  +                        ++id_start;
  +                    if(*id_start == '=' && id_start[1]) {
  +                        /*
  +                         * Session cookie was found, get it's value
  +                         */
                           char *id_end;
                           id_start = jk_pool_strdup(s->pool, id_start);
  -                        if(id_end = strchr(id_start, ';')) {
  +                        if((id_end = strchr(id_start, ';')) != NULL) {
  +                            *id_end = '\0';
  +                        }
  +                        if((id_start = strchr(id_start, ',')) != NULL) {
                               *id_end = '\0';
                           }
                           return id_start;
  
  
  

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