You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@apache.org on 2001/11/10 19:38:02 UTC

cvs commit: httpd-2.0/server util_script.c

rbb         01/11/10 10:38:02

  Modified:    .        CHANGES
               server   util_script.c
  Log:
  Improve http2env's performance by cutting the work it has to
  do.
  
  Submitted by:	Brian Pane <bp...@pacbell.net>
  
  Revision  Changes    Path
  1.425     +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.424
  retrieving revision 1.425
  diff -u -r1.424 -r1.425
  --- CHANGES	2001/11/09 23:15:42	1.424
  +++ CHANGES	2001/11/10 18:38:02	1.425
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0.29-dev
   
  +  *) Improve http2env's performance by cutting the work it has to
  +     do.  [Brian Pane <bp...@pacbell.net>]
  +
     *) use new 'apr_hash_merge' function in mod_mime (performance fix)
        [Brian Pane <bp...@pacbell.net>]
   
  
  
  
  1.65      +18 -10    httpd-2.0/server/util_script.c
  
  Index: util_script.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/util_script.c,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- util_script.c	2001/09/24 21:09:06	1.64
  +++ util_script.c	2001/11/10 18:38:02	1.65
  @@ -95,20 +95,28 @@
   #define MALFORMED_MESSAGE "malformed header from script. Bad header="
   #define MALFORMED_HEADER_LENGTH_TO_SHOW 30
   
  -static char *http2env(apr_pool_t *a, char *w)
  +static char *http2env(apr_pool_t *a, const char *w)
   {
  -    char *res = apr_pstrcat(a, "HTTP_", w, NULL);
  +    char *res = (char *)apr_palloc(a, sizeof("HTTP_") + strlen(w));
       char *cp = res;
  +    char c;
   
  -    while (*++cp) {
  -	if (!apr_isalnum(*cp) && *cp != '_') {
  -	    *cp = '_';
  -	}
  -	else {
  -	    *cp = apr_toupper(*cp);
  -	}
  -    }
  +    *cp++ = 'H';
  +    *cp++ = 'T';
  +    *cp++ = 'T';
  +    *cp++ = 'P';
  +    *cp++ = '_';
   
  +    while ((c = *w++) != 0) {
  +        if (!apr_isalnum(c)) {
  +            *cp++ = '_';
  +        }
  +        else {
  +            *cp++ = apr_toupper(c);
  +        }
  +    }
  +    *cp = 0;
  + 
       return res;
   }