Cosmetics
[privoxy.git] / parsers.c
index 02e0117..2272e87 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -1,4 +1,4 @@
-const char parsers_rcs[] = "$Id: parsers.c,v 1.36 2001/10/13 12:51:51 joergs Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.37 2001/10/23 21:36:02 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
@@ -18,10 +18,10 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.36 2001/10/13 12:51:51 joergs Exp
  *                IJBSWA team.  http://ijbswa.sourceforge.net
  *
  *                Based on the Internet Junkbuster originally written
- *                by and Copyright (C) 1997 Anonymous Coders and 
+ *                by and Copyright (C) 1997 Anonymous Coders and
  *                Junkbusters Corporation.  http://www.junkbusters.com
  *
- *                This program is free software; you can redistribute it 
+ *                This program is free software; you can redistribute it
  *                and/or modify it under the terms of the GNU General
  *                Public License as published by the Free Software
  *                Foundation; either version 2 of the License, or (at
@@ -41,6 +41,9 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.36 2001/10/13 12:51:51 joergs Exp
  *
  * Revisions   :
  *    $Log: parsers.c,v $
+ *    Revision 1.37  2001/10/23 21:36:02  jongfoster
+ *    Documenting sed()'s error behaviou (doc change only)
+ *
  *    Revision 1.36  2001/10/13 12:51:51  joergs
  *    Removed client_host, (was only required for the old 2.0.2-11 http://noijb.
  *    force-load), instead crumble Host: and add it (again) in client_host_adder
@@ -306,7 +309,7 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.36 2001/10/13 12:51:51 joergs Exp
 #include <assert.h>
 #include <string.h>
 
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__OS2__)
 #include <unistd.h>
 #endif
 
@@ -327,8 +330,8 @@ const char parsers_h_rcs[] = PARSERS_H_VERSION;
  * as an array index.  Therefore we need to make sure that high-bit
  * characters generate +ve values, and ideally we also want to make
  * the argument match the declared parameter type of "int".
- * 
- * Why did they write a character function that can't take a simple 
+ *
+ * Why did they write a character function that can't take a simple
  * "char" argument?  Doh!
  */
 #define ijb_isupper(__X) isupper((int)(unsigned char)(__X))
@@ -351,7 +354,7 @@ const struct parsers client_patterns[] = {
 /* { "if-modified-since:",       18,   crumble }, */
    { "Keep-Alive:",              11,   crumble },
    { "connection:",              11,   crumble },
-   { "proxy-connection:",        17,   crumble },        
+   { "proxy-connection:",        17,   crumble },
    { NULL,                       0,    NULL }
 };
 
@@ -363,7 +366,7 @@ const struct parsers server_patterns[] = {
    { "Content-Type:",      13, server_content_type },
    { "Content-Length:",    15, server_content_length },
    { "Content-MD5:",       12, server_content_md5 },
-   { "Content-Encoding:",  17, server_content_encoding },   
+   { "Content-Encoding:",  17, server_content_encoding },
    { "Transfer-Encoding:", 18, server_transfer_coding },
    { "Keep-Alive:",        11, crumble },
    { NULL, 0, NULL }
@@ -376,13 +379,13 @@ void (* const add_client_headers[])(struct client_state *) = {
    client_x_forwarded_adder,
    client_xtra_adder,
    client_accept_encoding_adder,
-   connection_close_adder, 
+   connection_close_adder,
    NULL
 };
 
 
 void (* const add_server_headers[])(struct client_state *) = {
-   connection_close_adder, 
+   connection_close_adder,
    NULL
 };
 
@@ -584,7 +587,7 @@ char *sed(const struct parsers pats[], void (* const more_headers[])(struct clie
          if (strncmpic(p->str, v->str, v->len) == 0)
          {
             hdr = v->parser(v, p->str, csp);
-            freez((char *)p->str); /* FIXME: Yuck! patching a list...*/
+            freez(p->str); /* FIXME: Yuck! patching a list...*/
             p->str = hdr;
          }
       }
@@ -653,7 +656,7 @@ void parse_http_request(char *req, struct http_request *http, struct client_stat
    int n;
 
    memset(http, '\0', sizeof(*http));
-   http->cmd = strdup(req);  
+   http->cmd = strdup(req);
 
    buf = strdup(req);
    n = ssplit(buf, " \r\n", v, SZ(v), 1, 1);
@@ -713,7 +716,7 @@ void parse_http_request(char *req, struct http_request *http, struct client_stat
                *p = '\0';
                http->hostport = strdup(url);
             }
-            /* 
+            /*
              * Repair broken HTTP requests that don't contain a path
              */
             else
@@ -862,7 +865,7 @@ char *server_transfer_coding(const struct parsers *v, const char *s, struct clie
       csp->content_type = CT_TABOO;
    }
 
-   /* 
+   /*
     * Raise flag if body chunked
     */
    if (strstr(s, "chunked"))
@@ -870,7 +873,7 @@ char *server_transfer_coding(const struct parsers *v, const char *s, struct clie
       csp->flags |= CSP_FLAG_CHUNKED;
 
       /*
-       * If the body was modified, it has been 
+       * If the body was modified, it has been
        * de-chunked first, so adjust the header:
        */
       if (csp->flags & CSP_FLAG_MODIFIED)
@@ -1067,7 +1070,7 @@ char *client_referrer(const struct parsers *v, const char *s, struct client_stat
 #ifdef FEATURE_FORCE_LOAD
    /* Since the referrer can include the prefix even
     * even if the request itself is non-forced, we must
-    * clean it unconditionally 
+    * clean it unconditionally
     */
    strclean(s, FORCE_PREFIX);
 #endif /* def FEATURE_FORCE_LOAD */
@@ -1371,7 +1374,7 @@ char *client_accept(const struct parsers *v, const char *s, struct client_state
    if (strstr (s, "image/gif"))
    {
       /* Client will accept HTML.  If this seems counterintuitive,
-       * blame Microsoft. 
+       * blame Microsoft.
        */
       csp->accept_types |= ACCEPT_TYPE_MSIE_HTML;
    }
@@ -1607,7 +1610,7 @@ void connection_close_adder(struct client_state *csp)
 char *server_http(const struct parsers *v, const char *s, struct client_state *csp)
 {
    char *ret = strdup(s);
-   
+
    sscanf(ret, "HTTP/%*d.%*d %d", &(csp->http->status));
    if (csp->http->status == 206)
    {
@@ -1659,12 +1662,12 @@ char *server_set_cookie(const struct parsers *v, const char *s, struct client_st
 }
 
 
-#ifdef FEATURE_FORCE_LOAD 
+#ifdef FEATURE_FORCE_LOAD
 /*********************************************************************
  *
  * Function    :  strclean
  *
- * Description :  In-Situ-Eliminate all occurances of substring in 
+ * Description :  In-Situ-Eliminate all occurances of substring in
  *                string
  *
  * Parameters  :
@@ -1684,7 +1687,7 @@ int strclean(const char *string, const char *substring)
       p = pos + len;
       do
       {
-         *(p - len) = *p; 
+         *(p - len) = *p;
       }
       while (*p++ != '\0');