You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by dg...@hyperreal.org on 1998/08/09 19:36:30 UTC

cvs commit: apache-1.3/src/modules/standard mod_cern_meta.c mod_include.c

dgaudet     98/08/09 10:36:30

  Modified:    src/include alloc.h
               src/main http_protocol.c util_script.c
               src/modules/proxy proxy_http.c proxy_util.c
               src/modules/standard mod_cern_meta.c mod_include.c
  Log:
  Just some comments.  Including a proposed ap_overlap_tables function which
  generalizes my new code in get_mime_headers().
  
  Revision  Changes    Path
  1.62      +24 -0     apache-1.3/src/include/alloc.h
  
  Index: alloc.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/include/alloc.h,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- alloc.h	1998/06/27 18:09:28	1.61
  +++ alloc.h	1998/08/09 17:36:24	1.62
  @@ -192,6 +192,30 @@
   
   API_EXPORT(table *) ap_overlay_tables(pool *p, const table *overlay, const table *base);
   
  +/* Conceptually, ap_overlap_tables does this:
  +
  +    array_header *barr = ap_table_elts(b);
  +    table_entry *belt = (table_entry *)barr->elts;
  +    int i;
  +
  +    for (i = 0; i < barr->nelts; ++i) {
  +	if (merge) {
  +	    ap_table_mergen(a, belt[i].key, belt[i].val);
  +	}
  +	else {
  +	    ap_table_setn(a, belt[i].key, belt[i].val);
  +	}
  +    }
  +
  +    Except that it is more efficient (less space and cpu-time) especially
  +    when b has many elements.
  +
  +    Notice the assumptions on the keys and values in b -- they must be
  +    in an ancestor of a's pool.  In practice b and a are usually from
  +    the same pool.
  +*/
  +API_EXPORT(void) ap_overlap_tables(table *a, const table *b, int merge);
  +
   /* XXX: these know about the definition of struct table in alloc.c.  That
    * definition is not here because it is supposed to be private, and by not
    * placing it here we are able to get compile-time diagnostics from modules
  
  
  
  1.235     +1 -0      apache-1.3/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_protocol.c,v
  retrieving revision 1.234
  retrieving revision 1.235
  diff -u -r1.234 -r1.235
  --- http_protocol.c	1998/08/09 16:57:29	1.234
  +++ http_protocol.c	1998/08/09 17:36:26	1.235
  @@ -739,6 +739,7 @@
       return (signed)a->order - (signed)b->order;
   }
   
  +/* XXX: could use ap_overlap_tables here... which generalizes this code */
   static void get_mime_headers(request_rec *r)
   {
       conn_rec *c = r->connection;
  
  
  
  1.128     +2 -0      apache-1.3/src/main/util_script.c
  
  Index: util_script.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/util_script.c,v
  retrieving revision 1.127
  retrieving revision 1.128
  diff -u -r1.127 -r1.128
  --- util_script.c	1998/08/06 18:58:21	1.127
  +++ util_script.c	1998/08/09 17:36:26	1.128
  @@ -188,6 +188,7 @@
       return env;
   }
   
  +/* XXX: this could use ap_overlap_tables */
   API_EXPORT(void) ap_add_common_vars(request_rec *r)
   {
       table *e = r->subprocess_env;
  @@ -546,6 +547,7 @@
   	    ap_table_add(r->err_headers_out, w, l);
   	}
   	else {
  +	    /* XXX: there is an O(n^2) space attack possible here */
   	    ap_table_merge(r->err_headers_out, w, l);
   	}
       }
  
  
  
  1.55      +1 -0      apache-1.3/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- proxy_http.c	1998/08/06 17:30:43	1.54
  +++ proxy_http.c	1998/08/09 17:36:27	1.55
  @@ -425,6 +425,7 @@
   	    continue;
   	if (!r->assbackwards) {
   	    ap_rvputs(r, hdr[i].field, ": ", hdr[i].value, CRLF, NULL);
  +	    /* XXX: can't this be ap_table_setn? -djg */
   	    ap_table_set(r->headers_out, hdr[i].field, hdr[i].value);
   	}
   	if (cache != NULL)
  
  
  
  1.67      +1 -0      apache-1.3/src/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- proxy_util.c	1998/08/06 17:30:44	1.66
  +++ proxy_util.c	1998/08/09 17:36:28	1.67
  @@ -641,6 +641,7 @@
   	if (hdrs[i].field == NULL)
   	    continue;
   	ap_bvputs(fp, hdrs[i].field, ": ", hdrs[i].value, CRLF, NULL);
  +	/* XXX: can't this be ap_table_setn? -djg */
   	ap_table_set(r->headers_out, hdrs[i].field, hdrs[i].value);
       }
   
  
  
  
  1.34      +1 -0      apache-1.3/src/modules/standard/mod_cern_meta.c
  
  Index: mod_cern_meta.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_cern_meta.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- mod_cern_meta.c	1998/08/06 17:30:56	1.33
  +++ mod_cern_meta.c	1998/08/09 17:36:29	1.34
  @@ -226,6 +226,7 @@
       {NULL}
   };
   
  +/* XXX: another O(n^2) attack here */
   static int scan_meta_file(request_rec *r, FILE *f)
   {
       char w[MAX_STRING_LEN];
  
  
  
  1.102     +1 -0      apache-1.3/src/modules/standard/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_include.c,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- mod_include.c	1998/08/06 17:30:58	1.101
  +++ mod_include.c	1998/08/09 17:36:29	1.102
  @@ -113,6 +113,7 @@
   
   /* ------------------------ Environment function -------------------------- */
   
  +/* XXX: could use ap_table_overlap here */
   static void add_include_vars(request_rec *r, char *timefmt)
   {
   #ifndef WIN32