X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;ds=inline;f=filters.c;h=a08dcba1dd92a82781775bb7c99103d5bb488957;hb=5af5acaa9aa8c28ebcb6eb7be8a5d61b1a4fbf34;hp=878c825312cc77367d5cb8cdc81438ff2525987f;hpb=5fc8530f3f835fa471fc6819f91d2def4f5e27de;p=privoxy.git diff --git a/filters.c b/filters.c index 878c8253..a08dcba1 100644 --- a/filters.c +++ b/filters.c @@ -1,4 +1,4 @@ -const char filters_rcs[] = "$Id: filters.c,v 1.123 2009/06/19 15:50:53 fabiankeil Exp $"; +const char filters_rcs[] = "$Id: filters.c,v 1.127 2010/04/03 13:22:56 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/filters.c,v $ @@ -599,7 +599,6 @@ struct http_response *block_url(struct client_state *csp) { log_error(LOG_LEVEL_ERROR, "handle-as-empty-document overruled by handle-as-image."); } -#if 1 /* Two alternative strategies, use this one for now: */ /* and handle accordingly: */ if ((p == NULL) || (0 == strcmpic(p, "pattern"))) @@ -624,7 +623,6 @@ struct http_response *block_url(struct client_state *csp) return cgi_error_memory(); } } - else if (0 == strcmpic(p, "blank")) { rsp->status = strdup("403 Request blocked by Privoxy"); @@ -647,7 +645,6 @@ struct http_response *block_url(struct client_state *csp) return cgi_error_memory(); } } - else { rsp->status = strdup("302 Local Redirect from Privoxy"); @@ -664,32 +661,10 @@ struct http_response *block_url(struct client_state *csp) } } -#else /* Following code is disabled for now */ - - /* and handle accordingly: */ - if ((p == NULL) || (0 == strcmpic(p, "pattern"))) - { - p = CGI_PREFIX "send-banner?type=pattern"; - } - else if (0 == strcmpic(p, "blank")) - { - p = CGI_PREFIX "send-banner?type=blank"; - } - rsp->status = strdup("302 Local Redirect from Privoxy"); - if (rsp->status == NULL) - { - free_http_response(rsp); - return cgi_error_memory(); - } - - if (enlist_unique_header(rsp->headers, "Location", p)) - { - free_http_response(rsp); - return cgi_error_memory(); - } -#endif /* Preceeding code is disabled for now */ } - else if(csp->action->flags & ACTION_HANDLE_AS_EMPTY_DOCUMENT) + else +#endif /* def FEATURE_IMAGE_BLOCKING */ + if(csp->action->flags & ACTION_HANDLE_AS_EMPTY_DOCUMENT) { /* * Send empty document. @@ -700,7 +675,21 @@ struct http_response *block_url(struct client_state *csp) rsp->body = strdup(" "); rsp->content_length = 1; - rsp->status = strdup("403 Request blocked by Privoxy"); + if (csp->config->feature_flags & RUNTIME_FEATURE_EMPTY_DOC_RETURNS_OK) + { + /* + * Workaround for firefox bug 492459 + * https://bugzilla.mozilla.org/show_bug.cgi?id=492459 + * Return a 200 OK status for pages blocked with +handle-as-empty-document + * if the "handle-as-empty-doc-returns-ok" runtime config option is set. + */ + rsp->status = strdup("200 Request blocked by Privoxy"); + } + else + { + rsp->status = strdup("403 Request blocked by Privoxy"); + } + if (rsp->status == NULL) { free_http_response(rsp); @@ -717,7 +706,6 @@ struct http_response *block_url(struct client_state *csp) } } else -#endif /* def FEATURE_IMAGE_BLOCKING */ /* * Else, generate an HTML "blocked" message: