httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r1209798 - in /httpd/httpd/trunk/modules/cache: cache_util.c mod_cache.c mod_cache.h
Date Sat, 03 Dec 2011 00:31:53 GMT
Author: minfrin
Date: Sat Dec  3 00:31:53 2011
New Revision: 1209798

URL: http://svn.apache.org/viewvc?rev=1209798&view=rev
Log:
mod_cache: Remove ap_cache_liststr(), it duplicates ap_find_token().

Modified:
    httpd/httpd/trunk/modules/cache/cache_util.c
    httpd/httpd/trunk/modules/cache/mod_cache.c
    httpd/httpd/trunk/modules/cache/mod_cache.h

Modified: httpd/httpd/trunk/modules/cache/cache_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_util.c?rev=1209798&r1=1209797&r2=1209798&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/cache_util.c (original)
+++ httpd/httpd/trunk/modules/cache/cache_util.c Sat Dec  3 00:31:53 2011
@@ -737,109 +737,6 @@ int cache_check_freshness(cache_handle_t
 
 }
 
-/*
- * 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)

Modified: httpd/httpd/trunk/modules/cache/mod_cache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_cache.c?rev=1209798&r1=1209797&r2=1209798&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_cache.c (original)
+++ httpd/httpd/trunk/modules/cache/mod_cache.c Sat Dec  3 00:31:53 2011
@@ -1014,9 +1014,7 @@ static int cache_save_filter(ap_filter_t
          */
         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) {

Modified: httpd/httpd/trunk/modules/cache/mod_cache.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_cache.h?rev=1209798&r1=1209797&r2=1209798&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_cache.h (original)
+++ httpd/httpd/trunk/modules/cache/mod_cache.h Sat Dec  3 00:31:53 2011
@@ -136,8 +136,6 @@ CACHE_DECLARE(void) ap_cache_usec2hex(ap
 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



Mime
View raw message