hgomez      01/10/01 14:30:49

  Modified:    jk/native/apache-1.3 mod_jk.c
               jk/native/apache-2.0 mod_jk.c
               jk/native/common jk_global.h
  Log:
  Updated code to handle getRequestURI()
    with compatibility mode for old TC and
    new schema (by default) for TC 3.3
  
  ForwardURICompat         => Forward URI normally, less spec compliant but 
mod_rewrite compatible (old TC)
  
  ForwardURICompatUnparsed => Forward URI as unparsed, spec compliant but broke 
mod_rewrite (old TC)
  
  ForwardURIEscaped        => Forward URI escaped and Tomcat (3.3 rc2) stuff will do 
the decoding part (default)
  
  Revision  Changes    Path
  1.18      +65 -8     jakarta-tomcat-connectors/jk/native/apache-1.3/mod_jk.c
  
  Index: mod_jk.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-1.3/mod_jk.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- mod_jk.c  2001/09/18 01:31:18     1.17
  +++ mod_jk.c  2001/10/01 21:30:49     1.18
  @@ -61,7 +61,7 @@
    * Author:      Gal Shachor <[EMAIL PROTECTED]>                           *
    *              Dan Milstein <[EMAIL PROTECTED]>                            *
    *              Henri Gomez <[EMAIL PROTECTED]>                               *
  - * Version:     $Revision: 1.17 $                                           *
  + * Version:     $Revision: 1.18 $                                           *
    ***************************************************************************/
   
   /*
  @@ -463,9 +463,42 @@
        * HttpServletRequest.getRequestURI() should remain encoded.
        * [http://java.sun.com/products/servlet/errata_042700.html]
        *
  +     * We use JkOptions to determine which method to be used 
  +     * 
  +     * ap_escape_uri is the latest recommanded but require 
  +     *               some java decoding (in TC 3.3 rc2)
  +     *
  +     * unparsed_uri is used for strict compliance with spec and
  +     *              old Tomcat (3.2.3 for example)
  +     *
  +     * uri is use for compatibilty with mod_rewrite with old Tomcats
        */
  -    s->req_uri      = ap_escape_uri(r->pool, r->uri);
   
  +    switch (conf->options & JK_OPT_FWDURIMASK) {
  +   
  +        case JK_OPT_FWDURICOMPATUNPARSED :
  +            s->req_uri      = r->unparsed_uri;
  +            if (s->req_uri != NULL) {
  +                char *query_str = strchr(s->req_uri, '?');
  +                if (query_str != NULL) {
  +                    *query_str = 0;
  +                }
  +            }
  +
  +        break;
  +
  +        case JK_OPT_FWDURICOMPAT :
  +            s->req_uri = r->uri;
  +        break;
  +
  +        case JK_OPT_FWDURIESCAPED :
  +            s->req_uri      = ap_escape_uri(r->pool, r->uri);
  +        break;
  +
  +        default :
  +            return JK_FALSE;
  +    }
  +
       s->is_ssl       = JK_FALSE;
       s->ssl_cert     = NULL;
       s->ssl_cert_len = 0;
  @@ -852,8 +885,11 @@
    * JkOptions Directive Handling
    *
    *
  - * +ForwardSSLKeySize => Forward SSL Key Size, to follow 2.3 specs but may broke 
old TC 3.2
  - * -ForwardSSLKeySize => Don't Forward SSL Key Size, will make mod_jk works with 
all TC release
  + * +ForwardSSLKeySize        => Forward SSL Key Size, to follow 2.3 specs but may 
broke old TC 3.2
  + * -ForwardSSLKeySize        => Don't Forward SSL Key Size, will make mod_jk works 
with all TC release
  + *  ForwardURICompat         => Forward URI normally, less spec compliant but 
mod_rewrite compatible (old TC)
  + *  ForwardURICompatUnparsed => Forward URI as unparsed, spec compliant but broke 
mod_rewrite (old TC)
  + *  ForwardURIEscaped        => Forward URI escaped and Tomcat (3.3 rc2) stuff will 
do the decoding part
    */
   
   const char *jk_set_options(cmd_parms *cmd,
  @@ -861,6 +897,7 @@
                              const char *line)
   {
       int  opt = 0; 
  +    int  mask = 0;
       char action;
       char *w;
   
  @@ -875,12 +912,29 @@
           if (*w == '+' || *w == '-') {
               action = *(w++);
           }
  +
  +        mask = 0;
   
  -        if (!strcasecmp(w, "ForwardKeySize"))
  +        if (!strcasecmp(w, "ForwardKeySize")) {
               opt = JK_OPT_FWDKEYSIZE;
  +        }
  +        else if (!strcasecmp(w, "ForwardURICompat")) {
  +            opt = JK_OPT_FWDURICOMPAT;
  +            mask = JK_OPT_FWDURIMASK;
  +        }
  +        else if (!strcasecmp(w, "ForwardURICompatUnparsed")) {
  +            opt = JK_OPT_FWDURICOMPATUNPARSED;
  +            mask = JK_OPT_FWDURIMASK;
  +        }
  +        else if (!strcasecmp(w, "ForwardURIEscaped")) {
  +            opt = JK_OPT_FWDURIESCAPED;
  +            mask = JK_OPT_FWDURIMASK;
  +        }
           else
               return ap_pstrcat(cmd->pool, "JkOptions: Illegal option '", w, "'", 
NULL);
   
  +        conf->options &= ~mask;
  +
           if (action == '-') {
               conf->options &= ~opt;
           }
  @@ -989,8 +1043,11 @@
       /*
        * Options to tune mod_jk configuration
        * for now we understand :
  -     * +ForwardSSLKeySize => Forward SSL Key Size, to follow 2.3 specs but may 
broke old TC 3.2
  -     * -ForwardSSLKeySize => Don't Forward SSL Key Size, will make mod_jk works 
with all TC release
  +     * +ForwardSSLKeySize        => Forward SSL Key Size, to follow 2.3 specs but 
may broke old TC 3.2
  +     * -ForwardSSLKeySize        => Don't Forward SSL Key Size, will make mod_jk 
works with all TC release
  +     *  ForwardURICompat         => Forward URI normally, less spec compliant but 
mod_rewrite compatible (old TC)
  +     *  ForwardURICompatUnparsed => Forward URI as unparsed, spec compliant but 
broke mod_rewrite (old TC)
  +     *  ForwardURIEscaped        => Forward URI escaped and Tomcat (3.3 rc2) stuff 
will do the decoding part
        */
       {"JkOptions", jk_set_options, NULL, RSRC_CONF, RAW_ARGS,
        "Set one of more options to configure the mod_jk module"},
  @@ -1098,7 +1155,7 @@
       c->log_level   = -1;
       c->log         = NULL;
       c->mountcopy   = JK_FALSE;
  -    c->options     = 0;
  +    c->options     = JK_OPT_FWDURIDEFAULT;
   
       /*
        * By default we will try to gather SSL info. 
  
  
  
  1.26      +66 -11    jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c
  
  Index: mod_jk.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- mod_jk.c  2001/09/18 01:31:18     1.25
  +++ mod_jk.c  2001/10/01 21:30:49     1.26
  @@ -60,7 +60,7 @@
    * Description: Apache 2 plugin for Jakarta/Tomcat                         *
    * Author:      Gal Shachor <[EMAIL PROTECTED]>                           *
    *                 Henri Gomez <[EMAIL PROTECTED]>                               *
  - * Version:     $Revision: 1.25 $                                           *
  + * Version:     $Revision: 1.26 $                                           *
    ***************************************************************************/
   
   /*
  @@ -445,9 +445,42 @@
        * HttpServletRequest.getRequestURI() should remain encoded.
        * [http://java.sun.com/products/servlet/errata_042700.html]
        *
  +     * We use JkOptions to determine which method to be used
  +     *
  +     * ap_escape_uri is the latest recommanded but require
  +     *               some java decoding (in TC 3.3 rc2)
  +     *
  +     * unparsed_uri is used for strict compliance with spec and
  +     *              old Tomcat (3.2.3 for example)
  +     *
  +     * uri is use for compatibilty with mod_rewrite with old Tomcats
        */
  -    s->req_uri      = ap_escape_uri(r->pool, r->uri);
   
  +    switch (conf->options & JK_OPT_FWDURIMASK) {
  +
  +        case JK_OPT_FWDURICOMPATUNPARSED :
  +            s->req_uri      = r->unparsed_uri;
  +            if (s->req_uri != NULL) {
  +                char *query_str = strchr(s->req_uri, '?');
  +                if (query_str != NULL) {
  +                    *query_str = 0;
  +                }
  +            }
  +
  +        break;
  +
  +        case JK_OPT_FWDURICOMPAT :
  +            s->req_uri = r->uri;
  +        break;
  +
  +        case JK_OPT_FWDURIESCAPED :
  +            s->req_uri      = ap_escape_uri(r->pool, r->uri);
  +        break;
  +
  +        default :
  +            return JK_FALSE;
  +    }
  +
       s->is_ssl       = JK_FALSE;
       s->ssl_cert     = NULL;
       s->ssl_cert_len = 0;
  @@ -564,8 +597,6 @@
       }
   
       return JK_TRUE;
  -
  -    return JK_TRUE;
   }
   
   /*
  @@ -851,8 +882,11 @@
    * JkOptions Directive Handling
    *
    *
  - * +ForwardSSLKeySize => Forward SSL Key Size, to follow 2.3 specs but may broke 
old TC 3.2
  - * -ForwardSSLKeySize => Don't Forward SSL Key Size, will make mod_jk works with 
all TC release
  + * +ForwardSSLKeySize        => Forward SSL Key Size, to follow 2.3 specs but may 
broke old TC 3.2
  + * -ForwardSSLKeySize        => Don't Forward SSL Key Size, will make mod_jk works 
with all TC release
  + *  ForwardURICompat         => Forward URI normally, less spec compliant but 
mod_rewrite compatible (old TC)
  + *  ForwardURICompatUnparsed => Forward URI as unparsed, spec compliant but broke 
mod_rewrite (old TC)
  + *  ForwardURIEscaped       => Forward URI escaped and Tomcat (3.3 rc2) stuff will 
do the decoding part
    */
   
   const char *jk_set_options(cmd_parms *cmd,
  @@ -860,6 +894,7 @@
                              const char *line)
   {
       int  opt = 0;
  +    int  mask = 0;
       char action;
       char *w;
   
  @@ -875,10 +910,27 @@
               action = *(w++);
           }
   
  -        if (!strcasecmp(w, "ForwardKeySize"))
  +        mask = 0;
  +
  +        if (!strcasecmp(w, "ForwardKeySize")) {
               opt = JK_OPT_FWDKEYSIZE;
  +        }
  +        else if (!strcasecmp(w, "ForwardURICompat")) {
  +            opt = JK_OPT_FWDURICOMPAT;
  +            mask = JK_OPT_FWDURIMASK;
  +        }
  +        else if (!strcasecmp(w, "ForwardURICompatUnparsed")) {
  +            opt = JK_OPT_FWDURICOMPATUNPARSED;
  +            mask = JK_OPT_FWDURIMASK;
  +        }
  +        else if (!strcasecmp(w, "ForwardURIEscaped")) {
  +            opt = JK_OPT_FWDURIESCAPED;
  +            mask = JK_OPT_FWDURIMASK;
  +        }
           else
  -            return apr_pstrcat(cmd->pool, "JkOptions: Illegal option '", w, "'", 
NULL);
  +            return ap_pstrcat(cmd->pool, "JkOptions: Illegal option '", w, "'", 
NULL);
  +
  +        conf->options &= ~mask;
   
           if (action == '-') {
               conf->options &= ~opt;
  @@ -1002,8 +1054,11 @@
       /*
        * Options to tune mod_jk configuration
        * for now we understand :
  -     * +ForwardSSLKeySize => Forward SSL Key Size, to follow 2.3 specs but may 
broke old TC 3.2
  -     * -ForwardSSLKeySize => Don't Forward SSL Key Size, will make mod_jk works 
with all TC release
  +     * +ForwardSSLKeySize        => Forward SSL Key Size, to follow 2.3 specs but 
may broke old TC 3.2
  +     * -ForwardSSLKeySize        => Don't Forward SSL Key Size, will make mod_jk 
works with all TC release
  +     *  ForwardURICompat         => Forward URI normally, less spec compliant but 
mod_rewrite compatible (old TC)
  +     *  ForwardURICompatUnparsed => Forward URI as unparsed, spec compliant but 
broke mod_rewrite (old TC)
  +     *  ForwardURIEscaped        => Forward URI escaped and Tomcat (3.3 rc2) stuff 
will do the decoding part
        */
       AP_INIT_RAW_ARGS(
           "JkOptions", jk_set_options, NULL, RSRC_CONF, 
  @@ -1202,7 +1257,7 @@
       c->log             = NULL;
       c->mountcopy       = JK_FALSE;
       c->was_initialized = JK_FALSE;
  -    c->options         = 0;
  +    c->options         = JK_OPT_FWDURIDEFAULT;
   
       /*
        * By default we will try to gather SSL info.
  
  
  
  1.8       +10 -2     jakarta-tomcat-connectors/jk/native/common/jk_global.h
  
  Index: jk_global.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_global.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- jk_global.h       2001/09/18 01:31:18     1.7
  +++ jk_global.h       2001/10/01 21:30:49     1.8
  @@ -59,7 +59,7 @@
    * Description: Global definitions and include files that should exist     *
    *              anywhere                                                   *
    * Author:      Gal Shachor <[EMAIL PROTECTED]>                           *
  - * Version:     $Revision: 1.7 $                                               *
  + * Version:     $Revision: 1.8 $                                               *
    ***************************************************************************/
   
   #ifndef JK_GLOBAL_H
  @@ -152,7 +152,15 @@
    * JK options
    */
   
  -#define JK_OPT_FWDKEYSIZE  0x0002
  +#define JK_OPT_FWDURIMASK           0x0003
  +
  +#define JK_OPT_FWDURICOMPAT         0x0001
  +#define JK_OPT_FWDURICOMPATUNPARSED 0x0002
  +#define JK_OPT_FWDURIESCAPED        0x0003
  +
  +#define JK_OPT_FWDURIDEFAULT        JK_OPT_FWDURIESCAPED
  +
  +#define JK_OPT_FWDKEYSIZE           0x0004
   
   #ifdef __cplusplus
   }
  
  
  


Reply via email to