]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_cache: Remove ap_cache_liststr(), it duplicates ap_find_token().
authorGraham Leggett <minfrin@apache.org>
Sat, 3 Dec 2011 00:31:53 +0000 (00:31 +0000)
committerGraham Leggett <minfrin@apache.org>
Sat, 3 Dec 2011 00:31:53 +0000 (00:31 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1209798 13f79535-47bb-0310-9956-ffa450edef68

modules/cache/cache_util.c
modules/cache/mod_cache.c
modules/cache/mod_cache.h

index 8a1050d3c6b5752e0bdfb1a2b07dd5ed71931cf5..4b19d1ed4b4a9e830d6685531e5611b5819a6c81 100644 (file)
@@ -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)
index b863b96784be824074812e7e35aa85d5de0b621d..00bae626f1cfd27d0974fc9bab72d47166361297 100644 (file)
@@ -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) {
index 90c3766ce25a1029bb508daca424232e4afdac11..53e80c039da19e6859a7303b02cccfb868a3d370 100644 (file)
@@ -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