source files for junkbuster documentation
[privoxy.git] / parsers.c
index 0f361cb..ec7e951 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -1,4 +1,4 @@
-const char parsers_rcs[] = "$Id: parsers.c,v 1.19 2001/07/25 17:21:54 oes Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.21 2001/07/31 14:46:00 oes Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
@@ -41,6 +41,16 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.19 2001/07/25 17:21:54 oes Exp $"
  *
  * Revisions   :
  *    $Log: parsers.c,v $
+ *    Revision 1.21  2001/07/31 14:46:00  oes
+ *     - Persistant connections now suppressed
+ *     - sed() no longer appends empty header to csp->headers
+ *
+ *    Revision 1.20  2001/07/30 22:08:36  jongfoster
+ *    Tidying up #defines:
+ *    - All feature #defines are now of the form FEATURE_xxx
+ *    - Permanently turned off WIN_GUI_EDIT
+ *    - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
+ *
  *    Revision 1.19  2001/07/25 17:21:54  oes
  *    client_uagent now saves copy of User-Agent: header value
  *
@@ -77,7 +87,7 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.19 2001/07/25 17:21:54 oes Exp $"
  *    CRLF -> LF
  *
  *    Revision 1.11  2001/05/29 20:11:19  joergs
- *    '/* inside comment' warning removed.
+ *    '/ * inside comment' warning removed.
  *
  *    Revision 1.10  2001/05/29 09:50:24  jongfoster
  *    Unified blocklist/imagelist/permissionslist.
@@ -250,7 +260,6 @@ const struct parsers client_patterns[] = {
    { "from:",                    5,    client_from },
    { "cookie:",                  7,    client_send_cookie },
    { "x-forwarded-for:",         16,   client_x_forwarded },
-   { "proxy-connection:",        17,   crumble },
 #ifdef FEATURE_DENY_GZIP
    { "Accept-Encoding: gzip",    21,   crumble },
 #endif /* def FEATURE_DENY_GZIP */
@@ -261,6 +270,9 @@ const struct parsers client_patterns[] = {
    { "Host:",                     5,   client_host },
 #endif /* def FEATURE_FORCE_LOAD */
 /* { "if-modified-since:",       18,   crumble }, */
+   { "Keep-Alive:",              11,   crumble },
+   { "connection:",              11,   crumble },
+   { "proxy-connection:",        17,   crumble },        
    { NULL,                       0,    NULL }
 };
 
@@ -278,11 +290,13 @@ void (* const add_client_headers[])(struct client_state *) = {
    client_cookie_adder,
    client_x_forwarded_adder,
    client_xtra_adder,
+   connection_close_adder,   
    NULL
 };
 
 
 void (* const add_server_headers[])(struct client_state *) = {
+   connection_close_adder, 
    NULL
 };
 
@@ -495,14 +509,6 @@ char *sed(const struct parsers pats[], void (* const more_headers[])(struct clie
       (*f)(csp);
    }
 
-   /* add the blank line at the end of the header, if necessary */
-   if ( (csp->headers->last == NULL)
-     || (csp->headers->last->str == NULL)
-     || (*csp->headers->last->str != '\0') )
-   {
-      enlist(csp->headers, "");
-   }
-
    hdr = list_to_text(csp->headers);
 
    return(hdr);
@@ -608,7 +614,7 @@ void parse_http_request(char *req, struct http_request *http, struct client_stat
 
          if (url)
          {
-            if (p = strchr(url, '/'))
+            if ((p = strchr(url, '/')))
             {
                http->path = strdup(p);
                *p = '\0';
@@ -1234,6 +1240,28 @@ void client_x_forwarded_adder(struct client_state *csp)
 }
 
 
+/*********************************************************************
+ *
+ * Function    :  connection_close_adder
+ *
+ * Description :  Adds a "Connection: close" header to csp->headers
+ *                as a temporary fix for the needed but missing HTTP/1.1
+ *                support. Called from `sed'.
+ *                FIXME: This whole function shouldn't be neccessary!
+ *
+ * Parameters  :
+ *          1  :  csp = Current client state (buffers, headers, etc...)
+ *
+ * Returns     :  N/A
+ *
+ *********************************************************************/
+void connection_close_adder(struct client_state *csp)
+{
+   enlist(csp->headers, strdup("Connection: close"));
+
+}
+
+
 /*********************************************************************
  *
  * Function    :  server_set_cookie