httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: httpd-2.0/server core.c
Date Wed, 19 Sep 2001 05:52:43 GMT
jerenkrantz    01/09/18 22:52:43

  Modified:    .        CHANGES
               include  http_request.h
               modules/http http_request.c
               modules/mappers mod_negotiation.c
               server   core.c
  Log:
  This patch eliminates the wasteful run-time conversion of method names from
  strings to numbers in places where the methods are known at compile
  time.
  
  (Justin fixed the va_end() call to be correct.)
  
  Submitted by:	Brian Pane <bpane@pacbell.net>
  Reviewed by:	Justin Erenkrantz
  
  Revision  Changes    Path
  1.364     +4 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.363
  retrieving revision 1.364
  diff -u -r1.363 -r1.364
  --- CHANGES	2001/09/18 23:09:12	1.363
  +++ CHANGES	2001/09/19 05:52:42	1.364
  @@ -1,5 +1,9 @@
   Changes with Apache 2.0.26-dev
   
  +  *) Eliminate the wasteful run-time conversion of method names from strings 
  +     to numbers in places where the methods are known at compile time.  
  +     [Brian Pane <bpane@pacbell.net>]
  +
     *) Turn the worker MPM's queue into a LIFO.  This may
        improve cache-hit performance under some conditions.
        [Aaron Bannert <aaron@clove.org>]
  
  
  
  1.37      +19 -0     httpd-2.0/include/http_request.h
  
  Index: http_request.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/http_request.h,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- http_request.h	2001/08/31 01:38:06	1.36
  +++ http_request.h	2001/09/19 05:52:42	1.37
  @@ -261,6 +261,25 @@
    */
   AP_DECLARE(void) ap_allow_methods(request_rec *r, int reset, ...);
   
  +/**
  + * Add one or more methods to the list permitted to access the resource.
  + * Usually executed by the content handler before the response header is
  + * sent, but sometimes invoked at an earlier phase if a module knows it
  + * can set the list authoritatively.  Note that the methods are ADDED
  + * to any already permitted unless the reset flag is non-zero.  The
  + * list is used to generate the Allow response header field when it
  + * is needed.
  + * @param   r     The pointer to the request identifying the resource.
  + * @param   reset Boolean flag indicating whether this list should
  + *                completely replace any current settings.
  + * @param   ...   A list of method identifiers, from the "M_" series
  + *                defined in httpd.h, terminated with a value of -1
  + *                (e.g., "M_GET, M_POST, M_OPTIONS, -1")
  + * @return  None.
  + * @deffunc void ap_allow_standard_methods(request_rec *r, int reset, ...)
  + */
  +AP_DECLARE(void) ap_allow_standard_methods(request_rec *r, int reset, ...);
  +
   #define MERGE_ALLOW 0
   #define REPLACE_ALLOW 1
   
  
  
  
  1.114     +24 -0     httpd-2.0/modules/http/http_request.c
  
  Index: http_request.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_request.c,v
  retrieving revision 1.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- http_request.c	2001/08/31 03:49:42	1.113
  +++ http_request.c	2001/09/19 05:52:42	1.114
  @@ -490,3 +490,27 @@
   	ap_method_list_add(r->allowed_methods, method);
       }
   }
  +
  +AP_DECLARE(void) ap_allow_standard_methods(request_rec *r, int reset, ...)
  +{
  +    int method;
  +    va_list methods;
  +    apr_int64_t mask;
  +
  +    /*
  +     * Get rid of any current settings if requested; not just the
  +     * well-known methods but any extensions as well.
  +     */
  +    if (reset) {
  +        ap_clear_method_list(r->allowed_methods);
  +    }
  +
  +    mask = 0;
  +    va_start(methods, reset);
  +    while ((method = va_arg(methods, int)) != -1) {
  +        mask |= (AP_METHOD_BIT << method);
  +    }
  +    va_end(methods);
  +
  +    r->allowed_methods->method_mask |= mask;
  +}
  
  
  
  1.82      +1 -1      httpd-2.0/modules/mappers/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_negotiation.c,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- mod_negotiation.c	2001/08/30 13:37:16	1.81
  +++ mod_negotiation.c	2001/09/19 05:52:42	1.82
  @@ -2768,7 +2768,7 @@
           apr_bucket_brigade *bb;
           apr_bucket *e;
   
  -        ap_allow_methods(r, REPLACE_ALLOW, "GET", "OPTIONS", "POST", NULL);
  +        ap_allow_standard_methods(r, REPLACE_ALLOW, M_GET, M_OPTIONS, M_POST, -1);
           if ((res = ap_discard_request_body(r)) != OK) {
               return res;
           }
  
  
  
  1.61      +1 -1      httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- core.c	2001/09/17 21:07:36	1.60
  +++ core.c	2001/09/19 05:52:42	1.61
  @@ -2676,7 +2676,7 @@
       bld_content_md5 = (d->content_md5 & 1)
         && r->output_filters->frec->ftype != AP_FTYPE_CONTENT;
   
  -    ap_allow_methods(r, MERGE_ALLOW, "GET", "OPTIONS", "POST", NULL);
  +    ap_allow_standard_methods(r, MERGE_ALLOW, M_GET, M_OPTIONS, M_POST, -1);
   
       if ((errstatus = ap_discard_request_body(r)) != OK) {
           return errstatus;
  
  
  

Mime
View raw message