httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject cvs commit: httpd-2.0/modules/http mod_mime.c
Date Sat, 08 Dec 2001 02:00:42 GMT
brianp      01/12/07 18:00:42

  Modified:    modules/http mod_mime.c
  Log:
  Reduced the number of times that we scan through each string
  looking for invalid characters in analyze_ct()
  
  Revision  Changes    Path
  1.75      +17 -7     httpd-2.0/modules/http/mod_mime.c
  
  Index: mod_mime.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/mod_mime.c,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- mod_mime.c	2001/12/07 12:29:04	1.74
  +++ mod_mime.c	2001/12/08 02:00:42	1.75
  @@ -529,8 +529,7 @@
   
   static content_type *analyze_ct(request_rec *r, const char *s)
   {
  -    const char *cp;
  -    const char *mp;
  +    const char *cp, *mp, *tmp;
       char *attribute, *value;
       int quoted = 0;
       server_rec * ss = r->server;
  @@ -555,13 +554,18 @@
   	return (NULL);
       }
       ctp->type = zap_sp_and_dup(p, mp, cp, NULL);
  -    if (ctp->type == NULL || *(ctp->type) == '\0' ||
  -	strchr(ctp->type, ';') || strchr(ctp->type, ' ') ||
  -	strchr(ctp->type, '\t')) {
  +    if (ctp->type == NULL || *(ctp->type) == '\0') {
   	ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ss,
   		     "Cannot get media subtype.");
   	return (NULL);
       }
  +    for (tmp = ctp->type; *tmp; tmp++) {
  +      if ((*tmp == ';') || (*tmp == ' ') || (*tmp == '\t')) {
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ss,
  +		     "Cannot get media subtype.");
  +	return (NULL);
  +      }
  +    }
   
       /* getting a subtype */
       cp++;
  @@ -570,11 +574,17 @@
       for (; *cp != ';' && *cp != '\0'; cp++)
           continue;
       ctp->subtype = zap_sp_and_dup(p, mp, cp, NULL);
  -    if ((ctp->subtype == NULL) || (*(ctp->subtype) == '\0') ||
  -	strchr(ctp->subtype, ' ') || strchr(ctp->subtype, '\t')) {
  +    if ((ctp->subtype == NULL) || (*(ctp->subtype) == '\0')) {
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ss,
  +		     "Cannot get media subtype.");
  +	return (NULL);
  +    }
  +    for (tmp = ctp->subtype; *tmp; tmp++) {
  +      if ((*tmp == ' ') || (*tmp == '\t')) {
   	ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ss,
   		     "Cannot get media subtype.");
   	return (NULL);
  +      }
       }
       if (*cp == '\0') {
           return (ctp);
  
  
  

Mime
View raw message