Return-Path: Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 93919 invoked by uid 500); 8 Dec 2001 02:20:01 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 93906 invoked by uid 500); 8 Dec 2001 02:20:01 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Date: 8 Dec 2001 02:00:42 -0000 Message-ID: <20011208020042.1385.qmail@icarus.apache.org> From: brianp@apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/modules/http mod_mime.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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);