Rename FEATURE_EXTENDED_HOST_PATTERNS to FEATURE_PCRE_HOST_PATTERNS
authorFabian Keil <fk@fabiankeil.de>
Wed, 5 Aug 2020 09:13:49 +0000 (11:13 +0200)
committerFabian Keil <fk@fabiankeil.de>
Thu, 6 Aug 2020 08:28:55 +0000 (10:28 +0200)
Sponsored by: Robert Klemme

acconfig.h
configure.in
project.h
urlmatch.c

index abbe2e2..a55d20a 100644 (file)
 /*
  * Allow PCRE syntax in host patterns.
  */
 /*
  * Allow PCRE syntax in host patterns.
  */
-#undef FEATURE_EXTENDED_HOST_PATTERNS
+#undef FEATURE_PCRE_HOST_PATTERNS
 
 /*
  * Allow filtering with scripts and programs.
 
 /*
  * Allow filtering with scripts and programs.
index 2ca7e24..b8667df 100644 (file)
@@ -978,8 +978,8 @@ AC_ARG_ENABLE(graceful-termination,
   AC_DEFINE(FEATURE_GRACEFUL_TERMINATION)
 fi])
 
   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
                                   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
                                   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,
 fi])
 
 AC_ARG_ENABLE(external-filters,
index 4a278cf..4c594ff 100644 (file)
--- a/project.h
+++ b/project.h
@@ -394,10 +394,10 @@ struct http_response
 
 struct url_spec
 {
 
 struct url_spec
 {
-#ifdef FEATURE_EXTENDED_HOST_PATTERNS
+#ifdef FEATURE_PCRE_HOST_PATTERNS
    regex_t *host_regex;/**< Regex for host matching                          */
    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)   */
    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)   */
index 553eaaa..868a16b 100644 (file)
@@ -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);
    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
 
 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;
 
 {
    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)
    {
    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);
    }
       /* 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')
    {
 
    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);
       }
       {
          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
 /*********************************************************************
  *
  * 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);
 }
 {
    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);
    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);
    }
    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;
    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);
                         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)));
       return ((NULL == pattern->pattern.url_spec.host_regex)
          || (0 == regexec(pattern->pattern.url_spec.host_regex,
                http->host, 0, NULL, 0)));