httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@hyperreal.com>
Subject cvs commit: apache/src CHANGES alloc.c alloc.h http_config.h httpd.h mod_env.c mod_negotiation.c util.c
Date Mon, 27 May 1996 19:48:46 GMT
akosut      96/05/27 12:48:45

  Modified:    src       CHANGES alloc.c alloc.h http_config.h httpd.h
                        mod_env.c  mod_negotiation.c util.c
  Log:
  Move get_token() and table_unset() from mod_negotiation.c and
  mod_env.c to util.c and alloc.c, respectively. Also add pstrndup()
  function to alloc.c.
  
  Revision  Changes    Path
  1.27      +3 -0      apache/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -C3 -r1.26 -r1.27
  *** CHANGES	1996/05/08 05:07:48	1.26
  --- CHANGES	1996/05/27 19:48:37	1.27
  ***************
  *** 1,3 ****
  --- 1,6 ----
  +   *) Several API additions: pstrndup(), table_unset() and get_token()
  +      functions now available to modules.
  + 
      *) htdigest utility included for use with digest authentication
         module.
    
  
  
  
  1.4       +38 -0     apache/src/alloc.c
  
  Index: alloc.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/alloc.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -C3 -r1.3 -r1.4
  *** alloc.c	1996/03/01 02:39:45	1.3
  --- alloc.c	1996/05/27 19:48:37	1.4
  ***************
  *** 384,389 ****
  --- 384,399 ----
      return res;
    }
    
  + char *pstrndup(struct pool *a, const char *s, int n)
  + {
  +   char *res;
  +   if (s == NULL) return NULL;
  +   res = palloc (a, n + 1);
  +   strncpy (res, s, n);
  +   res[n] = '\0';
  +   return res;
  + }
  + 
    char *pstrcat(pool *a, ...)
    {
      char *cp, *argp, *res;
  ***************
  *** 569,574 ****
  --- 579,612 ----
        elts->key = pstrdup (t->pool, key);
        elts->val = pstrdup (t->pool, val);
    }
  + 
  + void table_unset( table *t, char *key ) 
  + {
  +     table_entry *elts = (table_entry *)t->elts;
  +     int i;   
  +     int j;   
  +  
  +     for (i = 0; i < t->nelts; ++i)
  +         if (!strcasecmp (elts[i].key, key)) {
  +  
  +             /* found the element to skip over
  +              * there are any number of ways to remove an element from
  +              * a contiguous block of memory.  I've chosen one that
  +              * doesn't do a memcpy/bcopy/array_delete, *shrug*...
  +              */
  +             j = i;
  +             ++i;
  +             for ( ; i < t->nelts; ) {
  +                 elts[j].key = elts[i].key;
  +                 elts[j].val = elts[i].val;
  +                 ++i;
  +                 ++j;
  +             };
  +             --t->nelts;
  + 
  +             return;
  +         }
  + }     
    
    void table_merge (table *t, char *key, char *val)
    {
  
  
  
  1.4       +2 -0      apache/src/alloc.h
  
  Index: alloc.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/alloc.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -C3 -r1.3 -r1.4
  *** alloc.h	1996/03/01 02:39:46	1.3
  --- alloc.h	1996/05/27 19:48:38	1.4
  ***************
  *** 95,100 ****
  --- 95,101 ----
    void *palloc(struct pool *, int nbytes);
    void *pcalloc(struct pool *, int nbytes);
    extern char *pstrdup(struct pool *, const char *s);
  + extern char *pstrndup(struct pool *, const char *s, int n);
    char *pstrcat(struct pool *, ...); /* all '...' must be char* */
    
    /* array and alist management... keeping lists of things.
  ***************
  *** 146,151 ****
  --- 147,153 ----
    char *table_get (table *, char *);
    void table_set (table *, const char *name, const char *val);
    void table_merge (table *, char *name, char *more_val);
  + void table_unset (table *, char *key);
    
    table *overlay_tables (pool *p, table *overlay, table *base);     
    
  
  
  
  1.6       +1 -1      apache/src/http_config.h
  
  Index: http_config.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_config.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -C3 -r1.5 -r1.6
  *** http_config.h	1996/05/12 21:53:17	1.5
  --- http_config.h	1996/05/27 19:48:38	1.6
  ***************
  *** 197,203 ****
     * handle it back-compatibly, or at least signal an error).
     */
    
  ! #define MODULE_MAGIC_NUMBER 19960512
    #define STANDARD_MODULE_STUFF MODULE_MAGIC_NUMBER, 0, NULL
    
    /* Generic accessors for other modules to get at their own module-specific
  --- 197,203 ----
     * handle it back-compatibly, or at least signal an error).
     */
    
  ! #define MODULE_MAGIC_NUMBER 19960526
    #define STANDARD_MODULE_STUFF MODULE_MAGIC_NUMBER, 0, NULL
    
    /* Generic accessors for other modules to get at their own module-specific
  
  
  
  1.21      +2 -0      apache/src/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/httpd.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -C3 -r1.20 -r1.21
  *** httpd.h	1996/05/22 17:35:38	1.20
  --- httpd.h	1996/05/27 19:48:38	1.21
  ***************
  *** 489,494 ****
  --- 489,496 ----
    char *getword(pool *p, char **line, char stop);
    char *getword_nulls (pool *p, char **line, char stop);
    char *getword_conf (pool *p, char **line);      
  + 
  + char *get_token (pool *p, char **accept_line, int accept_white);
         
    int is_url(char *u);
    extern int unescape_url(char *url);
  
  
  
  1.2       +1 -35     apache/src/mod_env.c
  
  Index: mod_env.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_env.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -C3 -r1.1 -r1.2
  *** mod_env.c	1996/03/01 03:16:22	1.1
  --- mod_env.c	1996/05/27 19:48:39	1.2
  ***************
  *** 96,135 ****
    #include "httpd.h"
    #include "http_config.h"
    
  - /* utility functions, in the module code for now, but could
  -  * be moved to alloc.c when they've been proofed.
  -  */
  -  
  - void mod_env_table_unset( table *t, char *key ) 
  - {
  -     table_entry *elts = (table_entry *)t->elts;
  -     int i;   
  -     int j;   
  -  
  -     for (i = 0; i < t->nelts; ++i)
  -         if (!strcasecmp (elts[i].key, key)) {
  -  
  -             /* found the element to skip over
  -              * there are any number of ways to remove an element from
  -              * a contiguous block of memory.  I've chosen one that
  -              * doesn't do a memcpy/bcopy/array_delete, *shrug*...
  -              */
  -             j = i;
  -             ++i;
  -             for ( ; i < t->nelts; ) {
  -                 elts[j].key = elts[i].key;
  -                 elts[j].val = elts[i].val;
  -                 ++i;
  -                 ++j;
  -             };
  -             --t->nelts;
  - 
  -             return;
  -         }
  - }     
  - 
  - /* end of utility functions */
  - 
    typedef struct {
        table *vars;
        char *unsetenv;
  --- 96,101 ----
  ***************
  *** 182,188 ****
        copy = pstrdup( p, add->unsetenv );
        uenv = getword_conf( p, &copy );
        while ( uenv[0] != '\0' ) {
  ! 	mod_env_table_unset( new_table, uenv );
    	uenv = getword_conf( p, &copy );
        };
    
  --- 148,154 ----
        copy = pstrdup( p, add->unsetenv );
        uenv = getword_conf( p, &copy );
        while ( uenv[0] != '\0' ) {
  ! 	table_unset( new_table, uenv );
    	uenv = getword_conf( p, &copy );
        };
    
  
  
  
  1.7       +0 -46     apache/src/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -C3 -r1.6 -r1.7
  *** mod_negotiation.c	1996/04/17 14:02:17	1.6
  --- mod_negotiation.c	1996/05/27 19:48:39	1.7
  ***************
  *** 241,292 ****
     * HTTPD header lines and elsewhere.
     */
    
  - /* Retrieve a token, spacing over it and returning a pointer to
  -  * the first non-white byte afterwards.  Note that these tokens
  -  * are delimited by semis and commas; and can also be delimited
  -  * by whitespace at the caller's option.
  -  */
  - 
  - char *get_token (pool *p, char **accept_line, int accept_white)
  - {
  -     char *ptr = *accept_line;
  -     char *tok_start;
  -     char *token;
  -     int tok_len;
  -   
  -     /* Find first non-white byte */
  -     
  -     while (*ptr && isspace(*ptr))
  -       ++ptr;
  - 
  -     tok_start = ptr;
  -     
  -     /* find token end, skipping over quoted strings.
  -      * (comments are already gone).
  -      */
  -     
  -     while (*ptr && (accept_white || !isspace(*ptr))
  - 	   && *ptr != ';' && *ptr != ',')
  -     {
  - 	if (*ptr++ == '"')
  - 	    while (*ptr)
  - 	        if (*ptr++ == '"') break;
  -     }
  - 	  
  -     tok_len = ptr - tok_start;
  -     token = palloc (p, tok_len + 1);
  -     strncpy (token, tok_start, tok_len);
  -     token[tok_len] = '\0';
  -     
  -     /* Advance accept_line pointer to the next non-white byte */
  - 
  -     while (*ptr && isspace(*ptr))
  -       ++ptr;
  - 
  -     *accept_line = ptr;
  -     return token;
  - }
  - 
    /*
     * Get a single mime type entry --- one media type and parameters;
     * enter the values we recognize into the argument accept_rec
  --- 241,246 ----
  
  
  
  1.10      +46 -0     apache/src/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/util.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -C3 -r1.9 -r1.10
  *** util.c	1996/04/19 14:16:41	1.9
  --- util.c	1996/05/27 19:48:40	1.10
  ***************
  *** 482,487 ****
  --- 482,533 ----
        }
    }
    
  + /* Retrieve a token, spacing over it and returning a pointer to
  +  * the first non-white byte afterwards.  Note that these tokens
  +  * are delimited by semis and commas; and can also be delimited
  +  * by whitespace at the caller's option.
  +  */
  + 
  + char *get_token (pool *p, char **accept_line, int accept_white)
  + {
  +     char *ptr = *accept_line;
  +     char *tok_start;
  +     char *token;
  +     int tok_len;
  +   
  +     /* Find first non-white byte */
  +     
  +     while (*ptr && isspace(*ptr))
  +       ++ptr;
  + 
  +     tok_start = ptr;
  +     
  +     /* find token end, skipping over quoted strings.
  +      * (comments are already gone).
  +      */
  +     
  +     while (*ptr && (accept_white || !isspace(*ptr))
  + 	   && *ptr != ';' && *ptr != ',')
  +     {
  + 	if (*ptr++ == '"')
  + 	    while (*ptr)
  + 	        if (*ptr++ == '"') break;
  +     }
  + 	  
  +     tok_len = ptr - tok_start;
  +     token = palloc (p, tok_len + 1);
  +     strncpy (token, tok_start, tok_len);
  +     token[tok_len] = '\0';
  +     
  +     /* Advance accept_line pointer to the next non-white byte */
  + 
  +     while (*ptr && isspace(*ptr))
  +       ++ptr;
  + 
  +     *accept_line = ptr;
  +     return token;
  + }
  + 
    char *escape_shell_cmd(pool *p, char *s) {
        register int x,y,l;
        char *cmd;
  
  
  

Mime
View raw message