From: Fabian Keil Date: Wed, 5 Aug 2020 09:13:49 +0000 (+0200) Subject: Rename FEATURE_EXTENDED_HOST_PATTERNS to FEATURE_PCRE_HOST_PATTERNS X-Git-Tag: v_3_0_29~244 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=8666662f482bbfbb9c8407af506b5b82e2ef0dae Rename FEATURE_EXTENDED_HOST_PATTERNS to FEATURE_PCRE_HOST_PATTERNS Sponsored by: Robert Klemme --- diff --git a/acconfig.h b/acconfig.h index abbe2e28..a55d20a5 100644 --- a/acconfig.h +++ b/acconfig.h @@ -125,7 +125,7 @@ /* * Allow PCRE syntax in host patterns. */ -#undef FEATURE_EXTENDED_HOST_PATTERNS +#undef FEATURE_PCRE_HOST_PATTERNS /* * Allow filtering with scripts and programs. diff --git a/configure.in b/configure.in index 2ca7e247..b8667df3 100644 --- a/configure.in +++ b/configure.in @@ -978,8 +978,8 @@ AC_ARG_ENABLE(graceful-termination, AC_DEFINE(FEATURE_GRACEFUL_TERMINATION) fi]) -AC_ARG_ENABLE(extended-host-patterns, -[ --enable-extended-host-patterns Enable and require PCRE syntax in host patterns. This feature hasn't +AC_ARG_ENABLE(pcre-host-patterns, +[ --enable-pcre-host-patterns Enable and require PCRE syntax in host patterns. This feature hasn't been announced yet and it's not clear if it's a good idea. It's expected to work, but undocumented. You should only enable it if you know what PCRE is and are sure that you need it for your host patterns. You can @@ -987,7 +987,7 @@ AC_ARG_ENABLE(extended-host-patterns, use PCRE host patterns. Please don't enable this option when creating packages for others that may not be expecting it.], [if test $enableval = yes; then - AC_DEFINE(FEATURE_EXTENDED_HOST_PATTERNS) + AC_DEFINE(FEATURE_PCRE_HOST_PATTERNS) fi]) AC_ARG_ENABLE(external-filters, diff --git a/project.h b/project.h index 4a278cfa..4c594ff7 100644 --- a/project.h +++ b/project.h @@ -394,10 +394,10 @@ struct http_response struct url_spec { -#ifdef FEATURE_EXTENDED_HOST_PATTERNS +#ifdef FEATURE_PCRE_HOST_PATTERNS regex_t *host_regex;/**< Regex for host matching */ - enum host_regex_type { VANILLA_HOST_PATTERN, EXTENDED_HOST_PATTERN } host_regex_type; -#endif /* defined FEATURE_EXTENDED_HOST_PATTERNS */ + enum host_regex_type { VANILLA_HOST_PATTERN, PCRE_HOST_PATTERN } host_regex_type; +#endif /* defined FEATURE_PCRE_HOST_PATTERNS */ char *dbuffer; /**< Buffer with '\0'-delimited domain name, or NULL to match all hosts. */ char **dvec; /**< List of pointers to the strings in dbuffer. */ int dcount; /**< How many parts to this domain? (length of dvec) */ diff --git a/urlmatch.c b/urlmatch.c index 553eaaa5..868a16b3 100644 --- a/urlmatch.c +++ b/urlmatch.c @@ -63,7 +63,7 @@ enum regex_anchoring RIGHT_ANCHORED_HOST }; static jb_err compile_vanilla_host_pattern(struct pattern_spec *url, const char *host_pattern); -#ifdef FEATURE_EXTENDED_HOST_PATTERNS +#ifdef FEATURE_PCRE_HOST_PATTERNS static jb_err compile_pcre_host_pattern(struct pattern_spec *url, const char *host_pattern); #endif @@ -700,11 +700,11 @@ static jb_err compile_url_pattern(struct pattern_spec *url, char *buf) { char *p; -#ifdef FEATURE_EXTENDED_HOST_PATTERNS +#ifdef FEATURE_PCRE_HOST_PATTERNS const size_t prefix_length = 18; if (strncmpic(buf, "PCRE-HOST-PATTERN:", prefix_length) == 0) { - url->pattern.url_spec.host_regex_type = EXTENDED_HOST_PATTERN; + url->pattern.url_spec.host_regex_type = PCRE_HOST_PATTERN; /* Overwrite the "PCRE-HOST-PATTERN:" prefix */ memmove(buf, buf+prefix_length, strlen(buf+prefix_length)+1); } @@ -775,8 +775,8 @@ static jb_err compile_url_pattern(struct pattern_spec *url, char *buf) if (buf[0] != '\0') { -#ifdef FEATURE_EXTENDED_HOST_PATTERNS - if (url->pattern.url_spec.host_regex_type == EXTENDED_HOST_PATTERN) +#ifdef FEATURE_PCRE_HOST_PATTERNS + if (url->pattern.url_spec.host_regex_type == PCRE_HOST_PATTERN) { return compile_pcre_host_pattern(url, buf); } @@ -792,7 +792,7 @@ static jb_err compile_url_pattern(struct pattern_spec *url, char *buf) } -#ifdef FEATURE_EXTENDED_HOST_PATTERNS +#ifdef FEATURE_PCRE_HOST_PATTERNS /********************************************************************* * * Function : compile_pcre_host_pattern @@ -812,7 +812,7 @@ static jb_err compile_pcre_host_pattern(struct pattern_spec *url, const char *ho { return compile_pattern(host_pattern, RIGHT_ANCHORED_HOST, url, &url->pattern.url_spec.host_regex); } -#endif /* def FEATURE_EXTENDED_HOST_PATTERNS */ +#endif /* def FEATURE_PCRE_HOST_PATTERNS */ /********************************************************************* @@ -1240,13 +1240,13 @@ void free_pattern_spec(struct pattern_spec *pattern) if (pattern == NULL) return; freez(pattern->spec); -#ifdef FEATURE_EXTENDED_HOST_PATTERNS +#ifdef FEATURE_PCRE_HOST_PATTERNS if (pattern->pattern.url_spec.host_regex) { regfree(pattern->pattern.url_spec.host_regex); freez(pattern->pattern.url_spec.host_regex); } -#endif /* def FEATURE_EXTENDED_HOST_PATTERNS */ +#endif /* def FEATURE_PCRE_HOST_PATTERNS */ freez(pattern->pattern.url_spec.dbuffer); freez(pattern->pattern.url_spec.dvec); pattern->pattern.url_spec.dcount = 0; @@ -1300,8 +1300,8 @@ static int host_matches(const struct http_request *http, const struct pattern_spec *pattern) { assert(http->host != NULL); -#ifdef FEATURE_EXTENDED_HOST_PATTERNS - if (pattern->pattern.url_spec.host_regex_type == EXTENDED_HOST_PATTERN) { +#ifdef FEATURE_PCRE_HOST_PATTERNS + if (pattern->pattern.url_spec.host_regex_type == PCRE_HOST_PATTERN) { return ((NULL == pattern->pattern.url_spec.host_regex) || (0 == regexec(pattern->pattern.url_spec.host_regex, http->host, 0, NULL, 0)));