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/06/10 11:02:16 UTC

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

dgaudet     98/06/10 02:02:15

  Modified:    src      CHANGES
               src/include httpd.h
               src/main util.c util_script.c
               src/modules/standard mod_cern_meta.c mod_mime_magic.c
  Log:
  My "all content-types must be lowercase" change neglected param=value
  pairs... and would downcase the value, which is a case-sensitive thing.
  But, to be honest, the code prior to my changes neglected param=value
  pairs.  Another case where we really should have some core parsing
  routines that understand HTTP rather than the hodge-podge we have
  now.
  
  PR:		2394
  
  Revision  Changes    Path
  1.906     +5 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.905
  retrieving revision 1.906
  diff -u -r1.905 -r1.906
  --- CHANGES	1998/06/10 08:15:09	1.905
  +++ CHANGES	1998/06/10 09:01:58	1.906
  @@ -1,5 +1,10 @@
   Changes with Apache 1.3.1
   
  +  *) Apache would incorrectly downcase the entire Content-Type passed from
  +     CGIs.  This affected server-push scripts and such which use
  +     multipart/x-mixed-replace;boundary=ThisRandomString.
  +     [Dean Gaudet] PR#2394
  +
     *) PORT: QNX update to properly guess 32-bit systems.
        [Sean Boudreau <se...@qnx.com>] PR#2390
   
  
  
  
  1.223     +1 -0      apache-1.3/src/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/include/httpd.h,v
  retrieving revision 1.222
  retrieving revision 1.223
  diff -u -r1.222 -r1.223
  --- httpd.h	1998/06/07 01:22:36	1.222
  +++ httpd.h	1998/06/10 09:02:02	1.223
  @@ -896,6 +896,7 @@
   API_EXPORT(char *) ap_pregsub(pool *p, const char *input, const char *source,
   			   size_t nmatch, regmatch_t pmatch[]);
   
  +API_EXPORT(void) ap_content_type_tolower(char *);
   API_EXPORT(void) ap_str_tolower(char *);
   API_EXPORT(int) ap_ind(const char *, char);	/* Sigh... */
   API_EXPORT(int) ap_rind(const char *, char);
  
  
  
  1.120     +24 -0     apache-1.3/src/main/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/util.c,v
  retrieving revision 1.119
  retrieving revision 1.120
  diff -u -r1.119 -r1.120
  --- util.c	1998/06/06 19:30:48	1.119
  +++ util.c	1998/06/10 09:02:09	1.120
  @@ -1781,3 +1781,27 @@
       return (time1 - time0);
   }
   #endif
  +
  +/* we want to downcase the type/subtype for comparison purposes
  + * but nothing else because ;parameter=foo values are case sensitive.
  + * XXX: in truth we want to downcase parameter names... but really,
  + * apache has never handled parameters and such correctly.  You
  + * also need to compress spaces and such to be able to compare
  + * properly. -djg
  + */
  +API_EXPORT(void) ap_content_type_tolower(char *str)
  +{
  +    char *semi;
  +
  +    semi = strchr(str, ';');
  +    if (semi) {
  +	*semi = '\0';
  +    }
  +    while (*str) {
  +	*str = tolower(*str);
  +	++str;
  +    }
  +    if (semi) {
  +	*semi = ';';
  +    }
  +}
  
  
  
  1.116     +1 -1      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.115
  retrieving revision 1.116
  diff -u -r1.115 -r1.116
  --- util_script.c	1998/05/28 23:26:41	1.115
  +++ util_script.c	1998/06/10 09:02:09	1.116
  @@ -466,7 +466,7 @@
   		*endp-- = '\0';
   
   	    r->content_type = ap_pstrdup(r->pool, l);
  -	    ap_str_tolower(r->content_type);
  +	    ap_content_type_tolower(r->content_type);
   	}
   	/*
   	 * If the script returned a specific status, that's what
  
  
  
  1.30      +1 -1      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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- mod_cern_meta.c	1998/06/09 05:22:11	1.29
  +++ mod_cern_meta.c	1998/06/10 09:02:12	1.30
  @@ -269,7 +269,7 @@
   		*endp-- = '\0';
   
   	    r->content_type = ap_pstrdup(r->pool, l);
  -	    ap_str_tolower(r->content_type);
  +	    ap_content_type_tolower(r->content_type);
   	}
   	else if (!strcasecmp(w, "Status")) {
   	    sscanf(l, "%d", &r->status);
  
  
  
  1.34      +1 -1      apache-1.3/src/modules/standard/mod_mime_magic.c
  
  Index: mod_mime_magic.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_mime_magic.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- mod_mime_magic.c	1998/05/28 22:09:57	1.33
  +++ mod_mime_magic.c	1998/06/10 09:02:13	1.34
  @@ -816,7 +816,7 @@
   	r->content_type = rsl_strdup(r, type_frag, type_pos, type_len);
   	/* XXX: this could be done at config time I'm sure... but I'm
   	 * confused by all this magic_rsl stuff. -djg */
  -	ap_str_tolower(r->content_type);
  +	ap_content_type_tolower(r->content_type);
       }
       if (state == rsl_encoding) {
   	r->content_encoding = rsl_strdup(r, encoding_frag,