keith       2004/06/15 13:37:11

  Modified:    jk/native2/common jk_requtil.c
               jk/java/org/apache/ajp RequestHandler.java
               jk/xdocs/common AJPv13.xml
               jk/native2/include jk_service.h
               jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Previously the transport would fail for unrecognizned methods; this 

  changes mod_jk2 to send the full method string if the method is

  unrecognized.
  
  Revision  Changes    Path
  1.33      +12 -2     jakarta-tomcat-connectors/jk/native2/common/jk_requtil.c
  
  Index: jk_requtil.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_requtil.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- jk_requtil.c      21 Mar 2004 09:43:09 -0000      1.32
  +++ jk_requtil.c      15 Jun 2004 20:37:10 -0000      1.33
  @@ -67,6 +67,7 @@
   /* only in if JkOptions +ForwardKeySize */
   #define SC_A_SSL_KEY_SIZE       (unsigned char)11
   #define SC_A_SECRET             (unsigned char)12
  +#define SC_A_STORED_METHOD      (unsigned char)13
   #define SC_A_ARE_DONE           (unsigned char)0xFF
   
   /*
  @@ -189,7 +190,7 @@
           *sc = SC_M_MKACTIVITY;
       }
       else {
  -        rc = JK_ERR;
  +             *sc = SC_M_JK_STORED;
       }
   
       return rc;
  @@ -551,7 +552,7 @@
       rc = jk2_requtil_getMethodId(env, s->method, &method);
       if (rc != JK_OK) {
           env->l->jkLog(env, env->l, JK_LOG_ERROR,
  -                      "Error ajp_marshal_into_msgb - No such method %s\n",
  +                      "Error ajp_marshal_into_msgb - method %s\n",
                         s->method);
           return JK_ERR;
       }
  @@ -697,6 +698,15 @@
           }
       }
   
  +    /* If the method was unrecognized, encode it as an attribute */
  +     if (method == SC_M_JK_STORED) {
  +             if (msg->appendByte(env, msg, SC_A_STORED_METHOD) ||
  +            msg->appendString(env, msg, s->method)) {
  +            env->l->jkLog(env, env->l, JK_LOG_ERROR,
  +                         "handle.request() Error encoding method %s\n",
  +                         s->method);
  +             }
  +     }
   
       if (s->attributes->size(env, s->attributes) > 0) {
           for (i = 0; i < s->attributes->size(env, s->attributes); i++) {
  
  
  
  1.21      +10 -1     
jakarta-tomcat-connectors/jk/java/org/apache/ajp/RequestHandler.java
  
  Index: RequestHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/RequestHandler.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- RequestHandler.java       24 Feb 2004 08:48:43 -0000      1.20
  +++ RequestHandler.java       15 Jun 2004 20:37:10 -0000      1.21
  @@ -90,6 +90,7 @@
       public static final byte SC_A_SSL_SESSION   = 9;
       public static final byte SC_A_SSL_KEY_SIZE  = 11; // ajp14 originally, now in 
ajp13 with jk 1.2/2.0
       public static final byte SC_A_SECRET        = 12;
  +    public static final byte SC_A_STORED_METHOD = 13;
   
       // Used for attributes which are not in the list above
       public static final byte SC_A_REQ_ATTRIBUTE = 10; 
  @@ -127,6 +128,8 @@
           "BASELINE-CONTROL",
           "MKACTIVITY"
       };
  +    public static final int SC_M_JK_STORED = (byte) 0xFF;
  +
       
       // id's for common request headers
       public static final int SC_REQ_ACCEPT          = 1;
  @@ -254,7 +257,8 @@
   
           // Translate the HTTP method code to a String.
           byte methodCode = msg.getByte();
  -        req.method().setString(methodTransArray[(int)methodCode - 1]);
  +        if (methodCode != SC_M_JK_STORED)
  +          req.method().setString(methodTransArray[(int)methodCode - 1]);
   
           msg.getMessageBytes(req.protocol()); 
           msg.getMessageBytes(req.requestURI());
  @@ -402,6 +406,11 @@
                req.setAttribute("javax.servlet.request.key_size",
                                 Integer.toString(msg.getInt()));
                break;
  +    
  +        case SC_A_STORED_METHOD:
  +                req.method().setString(msg.getString());
  +                break;
  +    
            default:
                   // Ignore. Assume a single-string value - we shouldn't
                   // allow anything else.
  
  
  
  1.9       +5 -1      jakarta-tomcat-connectors/jk/xdocs/common/AJPv13.xml
  
  Index: AJPv13.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/xdocs/common/AJPv13.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AJPv13.xml        4 Mar 2004 04:46:34 -0000       1.8
  +++ AJPv13.xml        15 Jun 2004 20:37:10 -0000      1.9
  @@ -418,6 +418,10 @@
   </table>
   </p>
   
  +<p>Later version of ajp13, when used with mod_jk2, will transport 
  +additional methods, even if they are not in this list.
  +</p>
  +
   </subsection>
   
   <subsection  name="protocol, req_uri, remote_addr, remote_host, server_name, 
server_port, is_ssl">
  
  
  
  1.25      +2 -1      jakarta-tomcat-connectors/jk/native2/include/jk_service.h
  
  Index: jk_service.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_service.h,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- jk_service.h      21 Mar 2004 09:39:57 -0000      1.24
  +++ jk_service.h      15 Jun 2004 20:37:11 -0000      1.25
  @@ -83,6 +83,7 @@
   #define SC_M_MERGE              (unsigned char)25
   #define SC_M_BASELINE_CONTROL   (unsigned char)26
   #define SC_M_MKACTIVITY         (unsigned char)27
  +#define SC_M_JK_STORED          (unsigned char)0xFF
   
   
   /*
  
  
  
  1.38      +11 -3     
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- HandlerRequest.java       5 Jun 2004 05:19:04 -0000       1.37
  +++ HandlerRequest.java       15 Jun 2004 20:37:11 -0000      1.38
  @@ -108,6 +108,7 @@
       public static final byte SC_A_SSL_SESSION   = 9;
       public static final byte SC_A_SSL_KEYSIZE   = 11;
       public static final byte SC_A_SECRET        = 12;
  +    public static final byte SC_A_STORED_METHOD = 13;
   
       // Used for attributes which are not in the list above
       public static final byte SC_A_REQ_ATTRIBUTE = 10; 
  @@ -145,6 +146,7 @@
           "BASELINE-CONTROL",
           "MKACTIVITY"
       };
  +    public static final int SC_M_JK_STORED = (byte) 0xFF;
       
       // id's for common request headers
       public static final int SC_REQ_ACCEPT          = 1;
  @@ -461,9 +463,10 @@
           
           // Translate the HTTP method code to a String.
           byte methodCode = msg.getByte();
  -        String mName=methodTransArray[(int)methodCode - 1];
  -
  -        req.method().setString(mName);
  +        if (methodCode != SC_M_JK_STORED) {
  +            String mName=methodTransArray[(int)methodCode - 1];
  +            req.method().setString(mName);
  +        }
   
           msg.getBytes(req.protocol()); 
           msg.getBytes(req.requestURI());
  @@ -603,6 +606,11 @@
                   // endpoint note
                   ep.setNote( secretNote, secret );
                   break;
  +                
  +            case SC_A_STORED_METHOD:
  +                msg.getBytes(req.method()); 
  +                break;
  +                
               default:
                   break; // ignore, we don't know about it - backward compat
               }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to