X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=filters.c;h=4fc07a2570cccab090dbed61db36d3a4a36f9e68;hp=7e37c9b4d90dd4f3baa257fc3d7a31b1671310b6;hb=c999a1ed052c39b51c9f61c0cd6e114ea26616a3;hpb=c885b7ff0ffe914e0e26934c6bd62774315ce40f diff --git a/filters.c b/filters.c index 7e37c9b4..4fc07a25 100644 --- a/filters.c +++ b/filters.c @@ -1,4 +1,4 @@ -const char filters_rcs[] = "$Id: filters.c,v 1.43 2002/01/22 23:51:59 jongfoster Exp $"; +const char filters_rcs[] = "$Id: filters.c,v 1.48 2002/03/13 20:25:34 oes Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/filters.c,v $ @@ -38,6 +38,27 @@ const char filters_rcs[] = "$Id: filters.c,v 1.43 2002/01/22 23:51:59 jongfoster * * Revisions : * $Log: filters.c,v $ + * Revision 1.48 2002/03/13 20:25:34 oes + * Better logging for content filters + * + * Revision 1.47 2002/03/13 00:30:52 jongfoster + * Killing warnings + * Added option of always sending redirect for imageblock, + * currently disabled with #if 0. + * + * Revision 1.46 2002/03/12 01:42:49 oes + * Introduced modular filters + * + * Revision 1.45 2002/03/08 16:47:50 oes + * Added choice beween GIF and PNG built-in images + * + * Revision 1.44 2002/03/07 03:49:31 oes + * - Fixed compiler warnings etc + * - Changed built-in images from GIF to PNG + * (with regard to Unisys patent issue) + * - Added a 4x4 pattern PNG which is less intrusive + * than the logo but also clearly marks the deleted banners + * * Revision 1.43 2002/01/22 23:51:59 jongfoster * Replacing strsav() with the safer string_append(). * @@ -480,7 +501,7 @@ int acl_addr(char *aspec, struct access_control_addr *aca) masklength = 32; port = 0; - if ((p = strchr(aspec, '/'))) + if ((p = strchr(aspec, '/')) != NULL) { *p++ = '\0'; @@ -496,7 +517,7 @@ int acl_addr(char *aspec, struct access_control_addr *aca) return(-1); } - if ((p = strchr(aspec, ':'))) + if ((p = strchr(aspec, ':')) != NULL) { *p++ = '\0'; @@ -660,6 +681,8 @@ struct http_response *block_url(struct client_state *csp) /* determine HOW images should be blocked */ p = csp->action->string[ACTION_STRING_IMAGE_BLOCKER]; +#if 1 /* Two alternative strategies, use this one for now: */ + /* and handle accordingly: */ if ((p == NULL) || (0 == strcmpic(p, "logo"))) { @@ -671,7 +694,7 @@ struct http_response *block_url(struct client_state *csp) } rsp->content_length = image_logo_length; - if (enlist_unique_header(rsp->headers, "Content-Type", "image/png")) + if (enlist_unique_header(rsp->headers, "Content-Type", BUILTIN_IMAGE_MIMETYPE)) { free_http_response(rsp); return cgi_error_memory(); @@ -688,7 +711,7 @@ struct http_response *block_url(struct client_state *csp) } rsp->content_length = image_blank_length; - if (enlist_unique_header(rsp->headers, "Content-Type", "image/png")) + if (enlist_unique_header(rsp->headers, "Content-Type", BUILTIN_IMAGE_MIMETYPE)) { free_http_response(rsp); return cgi_error_memory(); @@ -705,7 +728,7 @@ struct http_response *block_url(struct client_state *csp) } rsp->content_length = image_pattern_length; - if (enlist_unique_header(rsp->headers, "Content-Type", "image/png")) + if (enlist_unique_header(rsp->headers, "Content-Type", BUILTIN_IMAGE_MIMETYPE)) { free_http_response(rsp); return cgi_error_memory(); @@ -727,6 +750,35 @@ struct http_response *block_url(struct client_state *csp) return cgi_error_memory(); } } + +#else /* Following code is disabled for now */ + + /* and handle accordingly: */ + if ((p == NULL) || (0 == strcmpic(p, "logo"))) + { + p = CGI_PREFIX "send-banner?type=logo"; + } + else if (0 == strcmpic(p, "blank")) + { + p = CGI_PREFIX "send-banner?type=blank"; + } + else if (0 == strcmpic(p, "pattern")) + { + p = CGI_PREFIX "send-banner?type=pattern"; + } + rsp->status = strdup("302 Local Redirect from Junkbuster"); + 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 #endif /* def FEATURE_IMAGE_BLOCKING */ @@ -872,7 +924,7 @@ struct http_response *trust_url(struct client_state *csp) * Export the trust list */ p = strdup(""); - for (tl = csp->config->trust_list; (t = *tl) ; tl++) + for (tl = csp->config->trust_list; (t = *tl) != NULL ; tl++) { sprintf(buf, "