You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by sh...@locus.apache.org on 2000/03/27 13:02:25 UTC

cvs commit: jakarta-tomcat/src/native/iis_netscape jk_lb_worker.c jk_global.h

shachor     00/03/27 03:02:25

  Modified:    src/native/iis_netscape jk_lb_worker.c jk_global.h
  Log:
  Adapt jni_lb_worker to URL rewrite.
  The session id is now a part of the path (used to be a variable)
  
  Revision  Changes    Path
  1.6       +23 -23    jakarta-tomcat/src/native/iis_netscape/jk_lb_worker.c
  
  Index: jk_lb_worker.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_lb_worker.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- jk_lb_worker.c	2000/03/21 00:32:39	1.5
  +++ jk_lb_worker.c	2000/03/27 11:02:25	1.6
  @@ -58,7 +58,7 @@
    *              several workers.                                           *
    * Author:      Gal Shachor <sh...@il.ibm.com>                           *
    * Based on:                                                               *
  - * Version:     $Revision: 1.5 $                                               *
  + * Version:     $Revision: 1.6 $                                               *
    ***************************************************************************/
   
   #include "jk_pool.h"
  @@ -112,30 +112,30 @@
   
   /* ========================================================================= */
   /* Retrieve the parameter with the given name                                */
  -static char *get_param(jk_ws_service_t *s,
  -                       const char *name)
  +static char *get_path_param(jk_ws_service_t *s,
  +                            const char *name)
   {
  -
  -    /* XXX XXX XXX need to fix - jsession id is path param, not query string.
  -       Gal, please take a look ! */
  -    if(s->query_string) {
  -        char *id_start = NULL;
  -        for(id_start = strstr(s->query_string, name) ; 
  -            id_start ; 
  -            id_start = strstr(id_start + 1, name)) {
  -            if('=' == id_start[strlen(name)]) {
  -                /*
  -                 * Session cookie was found, get it's value
  +    char *id_start = NULL;
  +    for(id_start = strstr(s->req_uri, name) ; 
  +        id_start ; 
  +        id_start = strstr(id_start + 1, name)) {
  +        if('=' == id_start[strlen(name)]) {
  +            /*
  +             * Session path-cookie was found, get it's value
  +             */
  +            id_start += (1 + strlen(name));
  +            if(strlen(id_start)) {
  +                char *id_end;
  +                id_start = jk_pool_strdup(s->pool, id_start);
  +                /* 
  +                 * The query string is not part of req_uri, however
  +                 * to be on the safe side lets remove the trailing query 
  +                 * string if appended...
                    */
  -                id_start += (1 + strlen(name));
  -                if(strlen(id_start)) {
  -                    char *id_end;
  -                    id_start = jk_pool_strdup(s->pool, id_start);
  -                    if(id_end = strchr(id_start, '&')) {
  -                        id_end = NULL;
  -                    }
  -                    return id_start;
  +                if(id_end = strchr(id_start, '?')) { 
  +                    id_end = NULL;
                   }
  +                return id_start;
               }
           }
       }
  @@ -185,7 +185,7 @@
   static char *get_sessionid(jk_ws_service_t *s)
   {
       char *val;
  -    val = get_param(s, JK_SESSION_IDENTIFIER);
  +    val = get_path_param(s, JK_PATH_SESSION_IDENTIFIER);
       if(!val) {
           val = get_cookie(s, JK_SESSION_IDENTIFIER);
       }
  
  
  
  1.5       +2 -1      jakarta-tomcat/src/native/iis_netscape/jk_global.h
  
  Index: jk_global.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_global.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- jk_global.h	2000/03/08 09:37:46	1.4
  +++ jk_global.h	2000/03/27 11:02:25	1.5
  @@ -57,7 +57,7 @@
    * Description: Global definitions and include files that should exist     *
    *              anywhere                                                   *
    * Author:      Gal Shachor <sh...@il.ibm.com>                           *
  - * Version:     $Revision: 1.4 $                                               *
  + * Version:     $Revision: 1.5 $                                               *
    ***************************************************************************/
   
   #ifndef JK_GLOBAL_H
  @@ -112,6 +112,7 @@
   #define JK_CR (13)
   
   #define JK_SESSION_IDENTIFIER "JSESSIONID"
  +#define JK_PATH_SESSION_IDENTIFIER ";jsessionid"
   
   #ifdef WIN32
       #define JK_METHOD __stdcall