From: Fabian Keil <fk@fabiankeil.de>
Date: Sat, 26 Apr 2008 10:34:18 +0000 (+0000)
Subject: If zlib support is unavailable and there are content filters active
X-Git-Tag: v_3_0_9~139
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/@default-cgi@/user-manual/faq/static/@default-cgi@send-stylesheet?a=commitdiff_plain;h=1ed5096954d986b54a1af1faf8ae0746d9be336f;p=privoxy.git

If zlib support is unavailable and there are content filters active
but the prevent-compression action is disabled, include a warning
on the show-url-info page that compression might prevent filtering.
---

diff --git a/ChangeLog b/ChangeLog
index 950fb792..9e167d3a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -45,6 +45,10 @@ ChangeLog for Privoxy
   interesting if you are using large action files or regularly use
   Privoxy-Regression-Test while running Privoxy through Valgrind,
   for stock configuration files it doesn't really matter.
+- If zlib support is unavailable and there are content
+  filters active but the prevent-compression action is disabled,
+  the show-url-info page includes a warning that compression
+  might prevent filtering.
 - The obsolete kill-popups action has been removed as the
   PCRS-based popup filters can do the same and are less
   unreliable.
diff --git a/cgisimple.c b/cgisimple.c
index 9cc23396..2ea674e0 100644
--- a/cgisimple.c
+++ b/cgisimple.c
@@ -1,4 +1,4 @@
-const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.70 2008/04/24 16:12:38 fabiankeil Exp $";
+const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.71 2008/04/25 13:33:56 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/cgisimple.c,v $
@@ -36,6 +36,10 @@ const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.70 2008/04/24 16:12:38 fabian
  *
  * Revisions   :
  *    $Log: cgisimple.c,v $
+ *    Revision 1.71  2008/04/25 13:33:56  fabiankeil
+ *    - Factor cgi_show_file() out of cgi_show_status().
+ *    - Adjust cgi_show_status()'s parameter description to match reality.
+ *
  *    Revision 1.70  2008/04/24 16:12:38  fabiankeil
  *    In cgi_show_status(), load the requested file at once.
  *    Using string_join() for every line really doesn't scale.
@@ -1682,6 +1686,23 @@ jb_err cgi_show_url_info(struct client_state *csp,
       }
 #endif /* FEATURE_CGI_EDIT_ACTIONS */
 
+      /*
+       * If zlib support is available, if no content filters
+       * are enabled or if the prevent-compression action is enabled,
+       * suppress the "compression could prevent filtering" warning.
+       *
+       * XXX: Change content_filters_enabled()'s prototype so we can
+       * use it here.
+       */
+#ifndef FEATURE_ZLIB
+      if ((list_is_empty(action->multi[ACTION_MULTI_FILTER])
+             && !(action->flags & ACTION_DEANIMATE))
+         || (action->flags & ACTION_NO_COMPRESSION))
+#endif
+      {
+         if (!err) err = map_block_killer(exports, "filters-might-be-ineffective");
+      }
+
       if (err || map(exports, "matches", 1, matches , 0))
       {
          free_current_action(action);
diff --git a/templates/show-url-info b/templates/show-url-info
index 06f4b94a..4c168fbf 100644
--- a/templates/show-url-info
+++ b/templates/show-url-info
@@ -27,6 +27,10 @@
 #
 # Revisions   :
 #    $Log: show-url-info,v $
+#    Revision 1.24  2008/02/10 17:26:52  fabiankeil
+#    Reduce superfluous white space by not marking
+#    up the final results list as paragraph.
+#
 #    Revision 1.23  2008/02/01 06:04:31  fabiankeil
 #    If edit buttons on the show-url-info CGI page are hidden, explain why.
 #
@@ -231,6 +235,20 @@
 <!--  if-cgi-editor-is-disabled-end@ -->
       </td>
     </tr>
+<!-- @if-filters-might-be-ineffective-start -->
+    <tr>
+      <td class="warning">
+        <h2>Warning:</h2>
+        <p>
+          This Privoxy version has been build without zlib support,
+          <strong>content filters will not work if the server sends compressed content.</strong>
+          Consider enabling the <a title="prevent-compression documentation"
+           href="@user-manual@actions-file.html#PREVENT-COMPRESSION">prevent-compression</a>
+          action for this URL or rebuild Privoxy with zlib support.
+        </p>
+      </td>
+    </tr>
+<!-- if-filters-might-be-ineffective-end@ -->
 <!-- @if-valid-url-start -->
     <tr>
       <td class="box">