Rebuilt based on latest configure.in
[privoxy.git] / filters.c
index 53748f1..e268d6d 100644 (file)
--- a/filters.c
+++ b/filters.c
@@ -1,4 +1,4 @@
-const char filters_rcs[] = "$Id: filters.c,v 1.20 2001/07/01 17:01:04 oes Exp $";
+const char filters_rcs[] = "$Id: filters.c,v 1.24 2001/07/25 17:22:51 oes Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/filters.c,v $
@@ -38,6 +38,25 @@ const char filters_rcs[] = "$Id: filters.c,v 1.20 2001/07/01 17:01:04 oes Exp $"
  *
  * Revisions   :
  *    $Log: filters.c,v $
+ *    Revision 1.24  2001/07/25 17:22:51  oes
+ *    Added workaround for Netscape bug that prevents display of page when loading a component fails.
+ *
+ *    Revision 1.23  2001/07/23 13:40:12  oes
+ *    Fixed bug that caused document body to be dropped when pcrs joblist was empty.
+ *
+ *    Revision 1.22  2001/07/18 12:29:34  oes
+ *    - Made gif_deanimate_response respect
+ *      csp->action->string[ACTION_STRING_DEANIMATE]
+ *    - Logging cosmetics
+ *
+ *    Revision 1.21  2001/07/13 13:59:53  oes
+ *     - Introduced gif_deanimate_response which shares the
+ *       generic content modification interface of pcrs_filter_response
+ *       and acts as a wrapper to deanimate.c:gif_deanimate()
+ *     - Renamed re_process_buffer to pcrs_filter_response
+ *     - pcrs_filter_response now returns NULL on failiure
+ *     - Removed all #ifdef PCRS
+ *
  *    Revision 1.20  2001/07/01 17:01:04  oes
  *    Added comments and missing return statement in is_untrusted_url()
  *
@@ -493,7 +512,24 @@ struct http_response *block_url(struct client_state *csp)
       rsp->body = fill_template(csp, "blocked", exports);
       free_map(exports);
   
-      rsp->status = strdup("403 Request for blocked URL"); 
+      /*
+       * Workaround for stupid Netscape bug which prevents
+       * pages from being displayed if loading a referenced
+       * JavaScript or style sheet fails. So make it appear
+       * as if it succeeded.
+       */
+      if (csp->http->user_agent
+          && !strncmpic(csp->http->user_agent, "mozilla", 7)
+          && !strstr(csp->http->user_agent, "compatible")
+          && !strstr(csp->http->user_agent, "Opera"))
+      {
+         rsp->status = strdup("200 Request for blocked URL"); 
+      }
+      else
+      {
+         rsp->status = strdup("404 Request for blocked URL"); 
+      }
+
    }
 
    return(finish_http_response(rsp));
@@ -909,6 +945,12 @@ char *pcrs_filter_response(struct client_state *csp)
       return(NULL);
    }
 
+   if ( NULL == b->joblist )
+   {
+      log_error(LOG_LEVEL_RE_FILTER, "Empty joblist. Nothing to do.");
+      return(NULL);
+   }
+
    log_error(LOG_LEVEL_RE_FILTER, "re_filtering %s%s (size %d) ...",
               csp->http->hostport, csp->http->path, size);
 
@@ -955,16 +997,16 @@ char *gif_deanimate_response(struct client_state *csp)
    if (  (NULL == (in =  (struct binbuffer *)zalloc(sizeof *in )))
       || (NULL == (out = (struct binbuffer *)zalloc(sizeof *out))) )
    {
-      log_error(LOG_LEVEL_DEANIMATE, "failed! (No Mem!)");
+      log_error(LOG_LEVEL_DEANIMATE, "failed! (no mem)");
       return NULL;
    }
 
    in->buffer = csp->iob->cur;
    in->size = size;
 
-   if (gif_deanimate(in, out))
+   if (gif_deanimate(in, out, strncmp("last", csp->action->string[ACTION_STRING_DEANIMATE], 4)))
    {
-      log_error(LOG_LEVEL_DEANIMATE, "failed! (size %d)", size);
+      log_error(LOG_LEVEL_DEANIMATE, "failed! (gif parsing)");
       free(in);
       buf_free(out);
       return(NULL);