From b8e4d2f10d54ba6e020c89f7b980062bc3ab028b Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@fabiankeil.de>
Date: Sat, 3 May 2008 16:40:45 +0000
Subject: [PATCH] Change content_filters_enabled()'s parameter from csp->action
 to action so it can be also used in the CGI code. Don't bother checking if
 there are filters loaded, as that's somewhat besides the point.

---
 filters.c | 14 ++++++++------
 filters.h |  7 +++++--
 parsers.c |  8 ++++++--
 3 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/filters.c b/filters.c
index 0d1d5443..4a959751 100644
--- a/filters.c
+++ b/filters.c
@@ -1,4 +1,4 @@
-const char filters_rcs[] = "$Id: filters.c,v 1.104 2008/03/27 18:27:24 fabiankeil Exp $";
+const char filters_rcs[] = "$Id: filters.c,v 1.105 2008/03/28 15:13:39 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/filters.c,v $
@@ -40,6 +40,9 @@ const char filters_rcs[] = "$Id: filters.c,v 1.104 2008/03/27 18:27:24 fabiankei
  *
  * Revisions   :
  *    $Log: filters.c,v $
+ *    Revision 1.105  2008/03/28 15:13:39  fabiankeil
+ *    Remove inspect-jpegs action.
+ *
  *    Revision 1.104  2008/03/27 18:27:24  fabiankeil
  *    Remove kill-popups action.
  *
@@ -2660,16 +2663,15 @@ struct http_response *direct_response(struct client_state *csp)
  *                enabled for the current request.
  *
  * Parameters  :  
- *          1  :  csp = Current client state (buffers, headers, etc...)
+ *          1  :  action = Action spec to check.
  *
  * Returns     :  TRUE for yes, FALSE otherwise
  *
  *********************************************************************/
-inline int content_filters_enabled(const struct client_state *csp)
+int content_filters_enabled(const struct current_action_spec *action)
 {
-   return (((csp->rlist != NULL) &&
-      (!list_is_empty(csp->action->multi[ACTION_MULTI_FILTER]))) ||
-      (csp->action->flags & ACTION_DEANIMATE));
+   return ((action->flags & ACTION_DEANIMATE) ||
+      !list_is_empty(action->multi[ACTION_MULTI_FILTER]));
 }
 
 /*
diff --git a/filters.h b/filters.h
index 3a5ac9f3..6a68d9a2 100644
--- a/filters.h
+++ b/filters.h
@@ -1,6 +1,6 @@
 #ifndef FILTERS_H_INCLUDED
 #define FILTERS_H_INCLUDED
-#define FILTERS_H_VERSION "$Id: filters.h,v 1.33 2008/02/23 16:57:12 fabiankeil Exp $"
+#define FILTERS_H_VERSION "$Id: filters.h,v 1.34 2008/03/02 12:25:25 fabiankeil Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/filters.h,v $
@@ -39,6 +39,9 @@
  *
  * Revisions   :
  *    $Log: filters.h,v $
+ *    Revision 1.34  2008/03/02 12:25:25  fabiankeil
+ *    Also use shiny new connect_port_is_forbidden() in jcc.c.
+ *
  *    Revision 1.33  2008/02/23 16:57:12  fabiankeil
  *    Rename url_actions() to get_url_actions() and let it
  *    use the standard parameter ordering.
@@ -335,7 +338,7 @@ extern char *get_last_url(char *subject, const char *redirect_mode);
 
 extern pcrs_job *compile_dynamic_pcrs_job_list(const struct client_state *csp, const struct re_filterfile_spec *b);
 
-extern inline int content_filters_enabled(const struct client_state *csp);
+extern int content_filters_enabled(const struct current_action_spec *action);
 
 /*
  * Handling Max-Forwards:
diff --git a/parsers.c b/parsers.c
index f3f5c86b..6c952c90 100644
--- a/parsers.c
+++ b/parsers.c
@@ -1,4 +1,4 @@
-const char parsers_rcs[] = "$Id: parsers.c,v 1.124 2008/04/16 16:38:21 fabiankeil Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.125 2008/04/17 14:40:49 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
@@ -44,6 +44,10 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.124 2008/04/16 16:38:21 fabiankei
  *
  * Revisions   :
  *    $Log: parsers.c,v $
+ *    Revision 1.125  2008/04/17 14:40:49  fabiankeil
+ *    Provide get_http_time() with the buffer size so it doesn't
+ *    have to blindly assume that the buffer is big enough.
+ *
  *    Revision 1.124  2008/04/16 16:38:21  fabiankeil
  *    Don't pass the whole csp structure to flush_socket()
  *    when it only needs a file descriptor and a buffer.
@@ -3471,7 +3475,7 @@ jb_err client_x_filter(struct client_state *csp, char **header)
  *********************************************************************/
 static jb_err client_range(struct client_state *csp, char **header)
 {
-   if (content_filters_enabled(csp))
+   if (content_filters_enabled(csp->action))
    {
       log_error(LOG_LEVEL_HEADER, "Content filtering is enabled."
          " Crunching: \'%s\' to prevent range-mismatch problems.", *header);
-- 
2.49.0