Excluded text/plain objects from filtering. This fixes a
authoroes <oes@users.sourceforge.net>
Fri, 11 Jul 2003 13:21:25 +0000 (13:21 +0000)
committeroes <oes@users.sourceforge.net>
Fri, 11 Jul 2003 13:21:25 +0000 (13:21 +0000)
couple of client-crashing, download corruption and
Privoxy performance issues, whose root cause lies in
web servers labelling content of unknown type as text/plain.

parsers.c

index 97d803d..9527cbd 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -1,4 +1,4 @@
-const char parsers_rcs[] = "$Id: parsers.c,v 1.56.2.6 2003/04/14 21:28:30 oes Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.56.2.7 2003/05/06 12:07:26 oes Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/Attic/parsers.c,v $
@@ -40,6 +40,9 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.56.2.6 2003/04/14 21:28:30 oes Ex
  *
  * Revisions   :
  *    $Log: parsers.c,v $
+ *    Revision 1.56.2.7  2003/05/06 12:07:26  oes
+ *    Fixed bug #729900: Suspicious HOST: headers are now killed and regenerated if necessary
+ *
  *    Revision 1.56.2.6  2003/04/14 21:28:30  oes
  *    Completing the previous change
  *
@@ -824,6 +827,9 @@ jb_err crumble(struct client_state *csp, char **header)
  * Description :  Set the content-type for filterable types (text/.*,
  *                javascript and image/gif) unless filtering has been
  *                forbidden (CT_TABOO) while parsing earlier headers.
+ *                NOTE: Since text/plain is commonly used by web servers
+ *                      for files whose correct type is unknown, we don't
+ *                      set CT_TEXT for it.
  *
  * Parameters  :
  *          1  :  csp = Current client state (buffers, headers, etc...)
@@ -840,7 +846,7 @@ jb_err server_content_type(struct client_state *csp, char **header)
 {
    if (csp->content_type != CT_TABOO)
    {
-      if (strstr(*header, " text/")
+      if ((strstr(*header, " text/") && !strstr(*header, "plain"))
        || strstr(*header, "application/x-javascript"))
          csp->content_type = CT_TEXT;
       else if (strstr(*header, " image/gif"))