tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billbar...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c
Date Thu, 15 Jul 2004 03:37:01 GMT
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 <Sandy@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


Mime
View raw message