From: Graham Leggett Date: Sat, 3 Dec 2011 00:31:53 +0000 (+0000) Subject: mod_cache: Remove ap_cache_liststr(), it duplicates ap_find_token(). X-Git-Tag: 2.5.0-alpha~7744 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26559c25c52885503d1f67f274b16f43ad91cc91;p=thirdparty%2Fapache%2Fhttpd.git mod_cache: Remove ap_cache_liststr(), it duplicates ap_find_token(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1209798 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/cache/cache_util.c b/modules/cache/cache_util.c index 8a1050d3c6b..4b19d1ed4b4 100644 --- a/modules/cache/cache_util.c +++ b/modules/cache/cache_util.c @@ -737,109 +737,6 @@ int cache_check_freshness(cache_handle_t *h, cache_request_rec *cache, } -/* - * list is a comma-separated list of case-insensitive tokens, with - * optional whitespace around the tokens. - * The return returns 1 if the token val is found in the list, or 0 - * otherwise. - */ -CACHE_DECLARE(int) ap_cache_liststr(apr_pool_t *p, const char *list, - const char *key, char **val) -{ - apr_size_t key_len; - const char *next; - - if (!list) { - return 0; - } - - key_len = strlen(key); - next = list; - - for (;;) { - - /* skip whitespace and commas to find the start of the next key */ - while (*next && (apr_isspace(*next) || (*next == ','))) { - next++; - } - - if (!*next) { - return 0; - } - - if (!strncasecmp(next, key, key_len)) { - /* this field matches the key (though it might just be - * a prefix match, so make sure the match is followed - * by either a space or an equals sign) - */ - next += key_len; - if (!*next || (*next == '=') || apr_isspace(*next) || - (*next == ',')) { - /* valid match */ - if (val) { - while (*next && (*next != '=') && (*next != ',')) { - next++; - } - if (*next == '=') { - next++; - while (*next && apr_isspace(*next )) { - next++; - } - if (!*next) { - *val = NULL; - } - else { - const char *val_start = next; - while (*next && !apr_isspace(*next) && - (*next != ',')) { - /* EAT QUOTED STRING */ - if (*next == '"' || *next == '\'') { - char delim = *next; - while (*++next != delim) { - if (!*next) { - return 0; - } - else if (*next == '\\') { - ++next; - } - } - } - next++; - } - *val = apr_pstrmemdup(p, val_start, - next - val_start); - } - } - else { - *val = NULL; - } - } - return 1; - } - } - - /* skip to the next field */ - do { - /* EAT QUOTED STRING */ - if (*next == '"' || *next == '\'') { - char delim = *next; - while (*++next != delim) { - if (!*next) { - return 0; - } - else if (*next == '\\') { - ++next; - } - } - } - next++; - if (!*next) { - return 0; - } - } while (*next != ','); - } -} - /* return each comma separated token, one at a time */ CACHE_DECLARE(const char *)ap_cache_tokstr(apr_pool_t *p, const char *list, const char **str) diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c index b863b96784b..00bae626f1c 100644 --- a/modules/cache/mod_cache.c +++ b/modules/cache/mod_cache.c @@ -1014,9 +1014,7 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in) */ reason = "Authorization required"; } - else if (ap_cache_liststr(NULL, - apr_table_get(r->headers_out, "Vary"), - "*", NULL)) { + else if (ap_find_token(NULL, apr_table_get(r->headers_out, "Vary"), "*")) { reason = "Vary header contains '*'"; } else if (apr_table_get(r->subprocess_env, "no-cache") != NULL) { diff --git a/modules/cache/mod_cache.h b/modules/cache/mod_cache.h index 90c3766ce25..53e80c039da 100644 --- a/modules/cache/mod_cache.h +++ b/modules/cache/mod_cache.h @@ -136,8 +136,6 @@ CACHE_DECLARE(void) ap_cache_usec2hex(apr_time_t j, char *y); CACHE_DECLARE(char *) ap_cache_generate_name(apr_pool_t *p, int dirlevels, int dirlength, const char *name); -CACHE_DECLARE(int) ap_cache_liststr(apr_pool_t *p, const char *list, - const char *key, char **val); CACHE_DECLARE(const char *)ap_cache_tokstr(apr_pool_t *p, const char *list, const char **str); /* Create a new table consisting of those elements from an