X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=urlmatch.c;h=3cd1147cc521abb4fa77a11a38b35407c45b7e8b;hp=4886e4c466500951c80e430fe8283eba1658427e;hb=278fe6edbae5404f576d913248d455fba6b2e12d;hpb=74f84988126c9680e5e05513a42016f0dbe6c185 diff --git a/urlmatch.c b/urlmatch.c index 4886e4c4..3cd1147c 100644 --- a/urlmatch.c +++ b/urlmatch.c @@ -302,7 +302,7 @@ jb_err parse_http_url(const char *url, struct http_request *http, int require_pr url_path ); *url_path = '\0'; - http->hostport = strdup_or_die(url_noproto); + http->hostport = string_tolower(url_noproto); } else { @@ -311,10 +311,15 @@ jb_err parse_http_url(const char *url, struct http_request *http, int require_pr * or CONNECT requests */ http->path = strdup_or_die("/"); - http->hostport = strdup_or_die(url_noproto); + http->hostport = string_tolower(url_noproto); } freez(buf); + + if (http->hostport == NULL) + { + return JB_ERR_PARSE; + } } if (!host_available) @@ -699,9 +704,9 @@ static jb_err compile_pattern(const char *pattern, enum regex_anchoring anchorin static jb_err compile_url_pattern(struct pattern_spec *url, char *buf) { char *p; + const size_t prefix_length = 18; #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 = PCRE_HOST_PATTERN; @@ -712,6 +717,22 @@ static jb_err compile_url_pattern(struct pattern_spec *url, char *buf) { url->pattern.url_spec.host_regex_type = VANILLA_HOST_PATTERN; } +#else + if (strncmpic(buf, "PCRE-HOST-PATTERN:", prefix_length) == 0) + { + log_error(LOG_LEVEL_ERROR, + "PCRE-HOST-PATTERN detected while Privoxy has been compiled " + "without FEATURE_PCRE_HOST_PATTERNS: %s", + buf); + /* Overwrite the "PCRE-HOST-PATTERN:" prefix */ + memmove(buf, buf+prefix_length, strlen(buf+prefix_length)+1); + /* + * The pattern will probably not work as expected. + * We don't simply return JB_ERR_PARSE here so the + * regression tests can be loaded with and without + * FEATURE_PCRE_HOST_PATTERNS. + */ + } #endif p = strchr(buf, '/');