Freshly built HTML docs for 3.0.5 beta.
[privoxy.git] / filters.c
index 92ad770..399a507 100644 (file)
--- a/filters.c
+++ b/filters.c
@@ -1,4 +1,4 @@
-const char filters_rcs[] = "$Id: filters.c,v 1.61 2006/08/03 02:46:41 david__schmidt Exp $";
+const char filters_rcs[] = "$Id: filters.c,v 1.64 2006/08/31 10:55:49 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/filters.c,v $
@@ -39,6 +39,18 @@ const char filters_rcs[] = "$Id: filters.c,v 1.61 2006/08/03 02:46:41 david__sch
  *
  * Revisions   :
  *    $Log: filters.c,v $
+ *    Revision 1.64  2006/08/31 10:55:49  fabiankeil
+ *    Block requests for untrusted URLs with status
+ *    code 403 instead of 200.
+ *
+ *    Revision 1.63  2006/08/31 10:11:28  fabiankeil
+ *    Don't free p which is still in use and will be later
+ *    freed by free_map(). Don't claim the referrer is unknown
+ *    when the client didn't set one.
+ *
+ *    Revision 1.62  2006/08/14 00:27:47  david__schmidt
+ *    Feature request 595948: Re-Filter logging in single line
+ *
  *    Revision 1.61  2006/08/03 02:46:41  david__schmidt
  *    Incorporate Fabian Keil's patch work:\rhttp://www.fabiankeil.de/sourcecode/privoxy/
  *
@@ -965,7 +977,7 @@ struct http_response *block_url(struct client_state *csp)
  * Function    :  trust_url FIXME: I should be called distrust_url
  *
  * Description :  Calls is_untrusted_url to determine if the URL is trusted
- *                and if not, returns a HTTP 304 response with a reject message.
+ *                and if not, returns a HTTP 403 response with a reject message.
  *
  * Parameters  :
  *          1  :  csp = Current client state (buffers, headers, etc...)
@@ -999,8 +1011,9 @@ struct http_response *trust_url(struct client_state *csp)
       return cgi_error_memory();
    }
 
+   rsp->status = strdup("403 Request blocked by Privoxy");
    exports = default_exports(csp, NULL);
-   if (exports == NULL)
+   if (exports == NULL || rsp->status == NULL)
    {
       free_http_response(rsp);
       return cgi_error_memory();
@@ -1019,7 +1032,7 @@ struct http_response *trust_url(struct client_state *csp)
    }
    else
    {
-      if (!err) err = map(exports, "referrer", 1, "unknown", 1);
+      if (!err) err = map(exports, "referrer", 1, "none set", 1);
    }
 
    if (err)
@@ -1039,7 +1052,6 @@ struct http_response *trust_url(struct client_state *csp)
       string_append(&p, buf);
    }
    err = map(exports, "trusted-referrers", 1, p, 0);
-   freez(p);
 
    if (err)
    {
@@ -1062,7 +1074,6 @@ struct http_response *trust_url(struct client_state *csp)
          string_append(&p, buf);
       }
       err = map(exports, "trust-info", 1, p, 0);
-      freez(p);
    }
    else
    {
@@ -1132,7 +1143,7 @@ struct http_response *redirect_url(struct client_state *csp)
    {
       q = csp->action->string[ACTION_STRING_REDIRECT];
    }
-   else
+   else if ((csp->action->flags & ACTION_FAST_REDIRECTS))
    {
       redirect_mode = csp->action->string[ACTION_STRING_FAST_REDIRECTS];
       if (0 == strcmpic(redirect_mode, "check-decoded-url"))
@@ -1174,6 +1185,11 @@ struct http_response *redirect_url(struct client_state *csp)
          q = p++;
       }
    }
+   else
+   {
+      /* All redirection actions are disabled */
+      return NULL;
+   }
    /*
     * if there was any, generate and return a HTTP redirect
     */