mturk       2004/07/28 23:53:44

  Modified:    ajp/ajplib/test ajp_header.c
  Log:
  Added sc_for_req_header_by_id instead sc_for_req_header.
  Apache already parses method for us, so there is no need to parse it again
  
  Revision  Changes    Path
  1.9       +43 -2     jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ajp_header.c      28 Jul 2004 19:20:50 -0000      1.8
  +++ ajp_header.c      29 Jul 2004 06:53:44 -0000      1.9
  @@ -209,7 +209,9 @@
       /* NOTREACHED */
   } 
   
  -
  +/* XXX: since we already have a method_number in request_rec
  + * we don't need this function
  + */
   static int sc_for_req_header(const char *header_name)
   {
       char header[16];
  @@ -297,6 +299,45 @@
       /* NOTREACHED */
   }
   
  +/* Apache method number to SC methods transform table */
  +static const unsigned char sc_for_req_header_table[] = {
  +    SC_M_GET,
  +    SC_M_PUT,
  +    SC_M_POST,
  +    SC_M_DELETE,
  +    0,                      /* M_DELETE */
  +    SC_M_OPTIONS,
  +    SC_M_TRACE,
  +    0,                      /* M_PATCH  */
  +    SC_M_PROPFIND,
  +    SC_M_PROPPATCH,
  +    SC_M_MKCOL,
  +    SC_M_COPY,
  +    SC_M_MOVE,
  +    SC_M_LOCK,
  +    SC_M_UNLOCK,
  +    SC_M_VERSION_CONTROL,
  +    SC_M_CHECKOUT,
  +    SC_M_UNCHECKOUT,
  +    SC_M_CHECKIN,
  +    SC_M_UPDATE,
  +    SC_M_LABEL,
  +    SC_M_REPORT,
  +    SC_M_MKWORKSPACE,
  +    SC_M_MKACTIVITY,
  +    SC_M_BASELINE_CONTROL,
  +    SC_M_MERGE,           
  +    0                       /* M_INVALID */
  +};
  +
  +static int sc_for_req_header_by_id(int method_id)
  +{
  +    if (method_id < 0 || method_id > M_INVALID)
  +        return UNKNOWN_METHOD;
  +    else
  +        return sc_for_req_header_table[method_id] ?
  +               sc_for_req_header_table[method_id] : UNKNOWN_METHOD;
  +}
   
   /*
    * Message structure
  @@ -342,7 +383,7 @@
       ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                            "Into ajp_marshal_into_msgb");
   
  -    if ((method = sc_for_req_method(r->method)) == UNKNOWN_METHOD) { 
  +    if ((method = sc_for_req_header_by_id(r->method_number)) == UNKNOWN_METHOD) { 
           ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
                  "Error ajp_marshal_into_msgb - No such method %s",
                  r->method);
  
  
  

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

Reply via email to