From: jongfoster Date: Sun, 7 Apr 2002 15:42:12 +0000 (+0000) Subject: Fixing send-banner?type=auto when the image-blocker is X-Git-Tag: v_2_9_14~173 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=ac2d3945628af3f3a2a1af774c0c7978c1303289 Fixing send-banner?type=auto when the image-blocker is a redirect to send-banner --- diff --git a/cgisimple.c b/cgisimple.c index 54d4eec6..60feef9b 100644 --- a/cgisimple.c +++ b/cgisimple.c @@ -1,4 +1,4 @@ -const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.26 2002/04/04 00:36:36 gliptak Exp $"; +const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.27 2002/04/05 15:50:48 oes Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgisimple.c,v $ @@ -36,6 +36,9 @@ const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.26 2002/04/04 00:36:36 glipta * * Revisions : * $Log: cgisimple.c,v $ + * Revision 1.27 2002/04/05 15:50:48 oes + * added send-stylesheet CGI + * * Revision 1.26 2002/04/04 00:36:36 gliptak * always use pcre for matching * @@ -425,18 +428,33 @@ jb_err cgi_send_banner(struct client_state *csp, #ifdef FEATURE_IMAGE_BLOCKING if ((csp->action->flags & ACTION_IMAGE_BLOCKER) != 0) { + static const char prefix1[] = CGI_PREFIX "send-banner?type="; + static const char prefix2[] = "http://" CGI_SITE_1_HOST "/send-banner?type="; + /* determine HOW images should be blocked */ const char * p = csp->action->string[ACTION_STRING_IMAGE_BLOCKER]; /* and handle accordingly: */ - if ((p != NULL) && (0 == strcmpic(p, "blank"))) + if (p == NULL) + { + /* Use default - nothing to do here. */ + } + else if (0 == strcmpic(p, "blank")) { imagetype = 'b'; } - else if ((p != NULL) && (0 == strcmpic(p, "pattern"))) + else if (0 == strcmpic(p, "pattern")) { imagetype = 'p'; } + else if (0 == strncmpic(p, prefix1, sizeof(prefix1) - 1)) + { + imagetype = p[sizeof(prefix1) - 1]; + } + else if (0 == strncmpic(p, prefix2, sizeof(prefix2) - 1)) + { + imagetype = p[sizeof(prefix2) - 1]; + } } #endif /* def FEATURE_IMAGE_BLOCKING */ }