windows/MYconfigure: Fix spelling of 'difference' in a comment
[privoxy.git] / urlmatch.c
index 3cd1147..1e10c07 100644 (file)
@@ -105,7 +105,7 @@ void free_http_request(struct http_request *http)
  * Description :  Splits the domain name so we can compare it
  *                against wildcards. It used to be part of
  *                parse_http_url, but was separated because the
- *                same code is required in chat in case of
+ *                same code is required in chat() in case of
  *                intercepted requests.
  *
  * Parameters  :
@@ -245,7 +245,7 @@ jb_err parse_http_url(const char *url, struct http_request *http, int require_pr
 
 
    /*
-    * Split URL into protocol,hostport,path.
+    * Split URL into protocol, hostport, path.
     */
    {
       char *buf;
@@ -263,7 +263,9 @@ jb_err parse_http_url(const char *url, struct http_request *http, int require_pr
       else if (strncmpic(url_noproto, "https://", 8) == 0)
       {
          /*
-          * Should only happen when called from cgi_show_url_info().
+          * Should only happen when called from cgi_show_url_info()
+          * or when the request was https-inspected and the request
+          * line got rewritten.
           */
          url_noproto += 8;
          http->ssl = 1;
@@ -1204,9 +1206,9 @@ jb_err create_pattern_spec(struct pattern_spec *pattern, char *buf)
       const unsigned flag;
    } tag_pattern[] = {
       { "TAG:",              4, PATTERN_SPEC_TAG_PATTERN},
- #ifdef FEATURE_CLIENT_TAGS
+#ifdef FEATURE_CLIENT_TAGS
       { "CLIENT-TAG:",      11, PATTERN_SPEC_CLIENT_TAG_PATTERN},
- #endif
+#endif
       { "NO-REQUEST-TAG:",  15, PATTERN_SPEC_NO_REQUEST_TAG_PATTERN},
       { "NO-RESPONSE-TAG:", 16, PATTERN_SPEC_NO_RESPONSE_TAG_PATTERN}
    };
@@ -1261,6 +1263,17 @@ void free_pattern_spec(struct pattern_spec *pattern)
    if (pattern == NULL) return;
 
    freez(pattern->spec);
+
+   if (!(pattern->flags & PATTERN_SPEC_URL_PATTERN))
+   {
+      if (pattern->pattern.tag_regex)
+      {
+         regfree(pattern->pattern.tag_regex);
+         freez(pattern->pattern.tag_regex);
+      }
+      return;
+   }
+
 #ifdef FEATURE_PCRE_HOST_PATTERNS
    if (pattern->pattern.url_spec.host_regex)
    {
@@ -1277,11 +1290,6 @@ void free_pattern_spec(struct pattern_spec *pattern)
       regfree(pattern->pattern.url_spec.preg);
       freez(pattern->pattern.url_spec.preg);
    }
-   if (pattern->pattern.tag_regex)
-   {
-      regfree(pattern->pattern.tag_regex);
-      freez(pattern->pattern.tag_regex);
-   }
 }