}
-/*
- * 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)
*/
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) {
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