Added server_content_encoding, renamed server_transfer_encoding
authoroes <oes@users.sourceforge.net>
Sun, 7 Oct 2001 18:50:55 +0000 (18:50 +0000)
committeroes <oes@users.sourceforge.net>
Sun, 7 Oct 2001 18:50:55 +0000 (18:50 +0000)
parsers.c
parsers.h

index 017ec4b..47550db 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -1,4 +1,4 @@
-const char parsers_rcs[] = "$Id: parsers.c,v 1.32 2001/10/07 15:43:28 oes Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.33 2001/10/07 18:04:49 oes Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
@@ -41,6 +41,11 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.32 2001/10/07 15:43:28 oes Exp $"
  *
  * Revisions   :
  *    $Log: parsers.c,v $
  *
  * Revisions   :
  *    $Log: parsers.c,v $
+ *    Revision 1.33  2001/10/07 18:04:49  oes
+ *    Changed server_http11 to server_http and its pattern to "HTTP".
+ *      Additional functionality: it now saves the HTTP status into
+ *      csp->http->status and sets CT_TABOO for Status 206 (partial range)
+ *
  *    Revision 1.32  2001/10/07 15:43:28  oes
  *    Removed FEATURE_DENY_GZIP and replaced it with client_accept_encoding,
  *       client_te and client_accept_encoding_adder, triggered by the new
  *    Revision 1.32  2001/10/07 15:43:28  oes
  *    Removed FEATURE_DENY_GZIP and replaced it with client_accept_encoding,
  *       client_te and client_accept_encoding_adder, triggered by the new
@@ -347,7 +352,8 @@ const struct parsers server_patterns[] = {
    { "Content-Type:",      13, server_content_type },
    { "Content-Length:",    15, server_content_length },
    { "Content-MD5:",       12, server_content_md5 },
    { "Content-Type:",      13, server_content_type },
    { "Content-Length:",    15, server_content_length },
    { "Content-MD5:",       12, server_content_md5 },
-   { "Transfer-Encoding:", 18, server_transfer_encoding },
+   { "Content-Encoding:",  17, server_content_encoding },   
+   { "Transfer-Encoding:", 18, server_transfer_coding },
    { "Keep-Alive:",        11, crumble },
    { NULL, 0, NULL }
 };
    { "Keep-Alive:",        11, crumble },
    { NULL, 0, NULL }
 };
@@ -818,10 +824,10 @@ char *server_content_type(const struct parsers *v, const char *s, struct client_
 
 /*********************************************************************
  *
 
 /*********************************************************************
  *
- * Function    :  server_transfer_encoding
+ * Function    :  server_transfer_coding
  *
  *
- * Description :  - Prohibit filtering (CT_TABOO) if encoding compresses
- *                - Raise the CSP_FLAG_CHUNKED flag if Encoding is "chunked"
+ * Description :  - Prohibit filtering (CT_TABOO) if transfer coding compresses
+ *                - Raise the CSP_FLAG_CHUNKED flag if coding is "chunked"
  *                - Change from "chunked" to "identity" if body was chunked
  *                  but has been de-chunked for filtering.
  *
  *                - Change from "chunked" to "identity" if body was chunked
  *                  but has been de-chunked for filtering.
  *
@@ -833,7 +839,7 @@ char *server_content_type(const struct parsers *v, const char *s, struct client_
  * Returns     :  A duplicate string pointer to this header (ie. pass thru)
  *
  *********************************************************************/
  * Returns     :  A duplicate string pointer to this header (ie. pass thru)
  *
  *********************************************************************/
-char *server_transfer_encoding(const struct parsers *v, const char *s, struct client_state *csp)
+char *server_transfer_coding(const struct parsers *v, const char *s, struct client_state *csp)
 {
    /*
     * Turn off pcrs and gif filtering if body compressed
 {
    /*
     * Turn off pcrs and gif filtering if body compressed
@@ -865,6 +871,35 @@ char *server_transfer_encoding(const struct parsers *v, const char *s, struct cl
 }
 
 
 }
 
 
+/*********************************************************************
+ *
+ * Function    :  server_content_encoding
+ *
+ * Description :  Prohibit filtering (CT_TABOO) if content encoding compresses
+ *
+ * Parameters  :
+ *          1  :  v = ignored
+ *          2  :  s = header string we are "considering"
+ *          3  :  csp = Current client state (buffers, headers, etc...)
+ *
+ * Returns     :  A duplicate string pointer to this header (ie. pass thru)
+ *
+ *********************************************************************/
+char *server_content_encoding(const struct parsers *v, const char *s, struct client_state *csp)
+{
+   /*
+    * Turn off pcrs and gif filtering if body compressed
+    */
+   if (strstr(s, "gzip") || strstr(s, "compress") || strstr(s, "deflate"))
+   {
+      csp->content_type = CT_TABOO;
+   }
+
+   return(strdup(s));
+
+}
+
+
 /*********************************************************************
  *
  * Function    :  server_content_length
 /*********************************************************************
  *
  * Function    :  server_content_length
index 1c23102..e7df11a 100644 (file)
--- a/parsers.h
+++ b/parsers.h
@@ -1,6 +1,6 @@
 #ifndef PARSERS_H_INCLUDED
 #define PARSERS_H_INCLUDED
 #ifndef PARSERS_H_INCLUDED
 #define PARSERS_H_INCLUDED
-#define PARSERS_H_VERSION "$Id: parsers.h,v 1.14 2001/10/07 15:45:48 oes Exp $"
+#define PARSERS_H_VERSION "$Id: parsers.h,v 1.15 2001/10/07 18:01:55 oes Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.h,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.h,v $
@@ -43,6 +43,9 @@
  *
  * Revisions   :
  *    $Log: parsers.h,v $
  *
  * Revisions   :
  *    $Log: parsers.h,v $
+ *    Revision 1.15  2001/10/07 18:01:55  oes
+ *    Changed server_http11 to server_http
+ *
  *    Revision 1.14  2001/10/07 15:45:48  oes
  *    added client_accept_encoding, client_te, client_accept_encoding_adder
  *
  *    Revision 1.14  2001/10/07 15:45:48  oes
  *    added client_accept_encoding, client_te, client_accept_encoding_adder
  *
@@ -153,7 +156,8 @@ extern char *server_set_cookie(const struct parsers *v, const char *s, struct cl
 extern char *server_content_type(const struct parsers *v, const char *s, struct client_state *csp);
 extern char *server_content_length(const struct parsers *v, const char *s, struct client_state *csp);
 extern char *server_content_md5(const struct parsers *v, const char *s, struct client_state *csp);
 extern char *server_content_type(const struct parsers *v, const char *s, struct client_state *csp);
 extern char *server_content_length(const struct parsers *v, const char *s, struct client_state *csp);
 extern char *server_content_md5(const struct parsers *v, const char *s, struct client_state *csp);
-extern char *server_transfer_encoding(const struct parsers *v, const char *s, struct client_state *csp);
+extern char *server_content_encoding(const struct parsers *v, const char *s, struct client_state *csp);
+extern char *server_transfer_coding(const struct parsers *v, const char *s, struct client_state *csp);
 extern char *server_http(const struct parsers *v, const char *s, struct client_state *csp);
 
 #ifdef FEATURE_FORCE_LOAD
 extern char *server_http(const struct parsers *v, const char *s, struct client_state *csp);
 
 #ifdef FEATURE_FORCE_LOAD