A few changes. A short section on regular expression in appendix.
[privoxy.git] / parsers.c
index dfdde1f..f9a8841 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -1,4 +1,4 @@
-const char parsers_rcs[] = "$Id: parsers.c,v 1.24 2001/09/13 23:05:50 jongfoster Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.28 2001/09/22 16:32:28 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
@@ -41,6 +41,20 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.24 2001/09/13 23:05:50 jongfoster
  *
  * Revisions   :
  *    $Log: parsers.c,v $
+ *    Revision 1.28  2001/09/22 16:32:28  jongfoster
+ *    Removing unused #includes.
+ *
+ *    Revision 1.27  2001/09/20 15:45:25  steudten
+ *
+ *    add casting from size_t to int for printf()
+ *    remove local variable shadow s2
+ *
+ *    Revision 1.26  2001/09/16 17:05:14  jongfoster
+ *    Removing unused #include showarg.h
+ *
+ *    Revision 1.25  2001/09/16 13:21:27  jongfoster
+ *    Changes to use new list functions.
+ *
  *    Revision 1.24  2001/09/13 23:05:50  jongfoster
  *    Changing the string paramater to the header parsers a "const".
  *
@@ -225,10 +239,13 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.24 2001/09/13 23:05:50 jongfoster
 
 #include "config.h"
 
+#ifndef _WIN32
 #include <stdio.h>
 #include <sys/types.h>
 #include <stdlib.h>
 #include <ctype.h>
+#endif
+
 #include <string.h>
 
 #ifndef _WIN32
@@ -239,15 +256,10 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.24 2001/09/13 23:05:50 jongfoster
 #include "list.h"
 #include "parsers.h"
 #include "encode.h"
-#include "filters.h"
-#include "loaders.h"
-#include "showargs.h"
-#include "jcc.h"
 #include "ssplit.h"
 #include "errlog.h"
 #include "jbsockets.h"
 #include "miscutil.h"
-#include "cgi.h"
 
 const char parsers_h_rcs[] = PARSERS_H_VERSION;
 
@@ -779,9 +791,9 @@ char *content_length(const struct parsers *v, const char *s, struct client_state
    if (csp->content_length != 0) /* Content has been modified */
    {
       char * s2 = (char *) zalloc(100);
-      sprintf(s2, "Content-Length: %d", csp->content_length);
+      sprintf(s2, "Content-Length: %d", (int) csp->content_length);
 
-         log_error(LOG_LEVEL_HEADER, "Adjust Content-Length to %d", csp->content_length);
+         log_error(LOG_LEVEL_HEADER, "Adjust Content-Length to %d", (int) csp->content_length);
       return(s2);
    }
    else
@@ -868,13 +880,13 @@ char *client_referrer(const struct parsers *v, const char *s, struct client_stat
       /*
        * We have a specific (fixed) referer we want to send.
        */
-      char * s2;
+      char * s3;
 
       log_error(LOG_LEVEL_HEADER, "modified");
 
-      s2 = strsav( NULL, "Referer: " );
-      s2 = strsav( s2, newval );
-      return(s2);
+      s3 = strsav( NULL, "Referer: " );
+      s3 = strsav( s3, newval );
+      return(s3);
    }
 
    /* Should never get here! */
@@ -1257,6 +1269,7 @@ void client_x_forwarded_adder(struct client_state *csp)
    log_error(LOG_LEVEL_HEADER, "addh: %s", p);
    enlist(csp->headers, p);
 
+   freez(p);
 }
 
 
@@ -1277,8 +1290,7 @@ void client_x_forwarded_adder(struct client_state *csp)
  *********************************************************************/
 void connection_close_adder(struct client_state *csp)
 {
-   enlist(csp->headers, strdup("Connection: close"));
-
+   enlist(csp->headers, "Connection: close");
 }
 
 
@@ -1338,7 +1350,9 @@ char *client_host(const struct parsers *v, const char *s, struct client_state *c
    char *cleanhost = strdup(s);
  
    if(csp->force)
+   {
       strclean(cleanhost, FORCE_PREFIX);
+   }
  
    return(cleanhost);
 }