Deleted _DEBUG and PID_FILE_PATH
[privoxy.git] / jcc.c
diff --git a/jcc.c b/jcc.c
index 46c6db4..28ee02b 100644 (file)
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.62 2002/02/20 23:17:23 jongfoster Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.65 2002/03/03 14:49:11 oes Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -33,6 +33,15 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.62 2002/02/20 23:17:23 jongfoster Exp $";
  *
  * Revisions   :
  *    $Log: jcc.c,v $
+ *    Revision 1.65  2002/03/03 14:49:11  oes
+ *    Fixed CLF logging: Now uses client's original HTTP request
+ *
+ *    Revision 1.64  2002/03/03 09:18:03  joergs
+ *    Made jumbjuster work on AmigaOS again.
+ *
+ *    Revision 1.63  2002/03/02 04:14:50  david__schmidt
+ *    Clean up a little CRLF unpleasantness that suddenly appeared
+ *
  *    Revision 1.62  2002/02/20 23:17:23  jongfoster
  *    Detecting some out-of memory conditions and exiting with a log message.
  *
@@ -479,8 +488,6 @@ const char project_h_rcs[] = PROJECT_H_VERSION;
 struct client_state  clients[1];
 struct file_list     files[1];
 
-short int MustReload = 0;
-
 #ifdef FEATURE_STATISTICS
 int urls_read     = 0;     /* total nr of urls read inc rejected */
 int urls_rejected = 0;     /* total nr of urls rejected */
@@ -522,7 +529,7 @@ static const char VANILLA_WAFER[] =
    "(copyright_or_otherwise)_applying_to_any_cookie._";
 
 
-#if !defined(_WIN32) && !defined(__OS2__)
+#if !defined(_WIN32) && !defined(__OS2__) && !defined(AMIGA)
 /*********************************************************************
  *
  * Function    :  SIG_handler 
@@ -541,7 +548,7 @@ static void SIG_handler( int signal )
    switch( signal )
    {
       case SIGHUP:
-         MustReload = 1;
+         log_error(LOG_LEVEL_INFO, "ignoring HUP signal (%d)", signal);
          break;
       case SIGTERM:
          log_error(LOG_LEVEL_INFO, "exiting by signal %d .. bye", signal);
@@ -779,6 +786,16 @@ static void chat(struct client_state *csp)
       }
    }
 
+   /* 
+    * Save a copy of the original request for logging
+    */
+   http->ocmd = strdup(http->cmd);
+
+   if (http->ocmd == NULL)
+   {
+      log_error(LOG_LEVEL_FATAL, "Out of memory copying HTTP request line");
+   }
+
    /*
     * (Re)build the HTTP request for non-SSL requests.
     * If forwarding, use the whole URL, else, use only the path.
@@ -897,7 +914,7 @@ static void chat(struct client_state *csp)
 
       /* Log (FIXME: All intercept reasons apprear as "crunch" with Status 200) */
       log_error(LOG_LEVEL_GPC, "%s%s crunch!", http->hostport, http->path);
-      log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 200 3", csp->ip_addr_str, http->cmd);
+      log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 200 3", csp->ip_addr_str, http->ocmd);
 
       /* Clean up and return */
       free_http_response(rsp);
@@ -930,14 +947,14 @@ static void chat(struct client_state *csp)
          rsp = error_response(csp, "no-such-domain", errno);
 
          log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 404 0",
-                   csp->ip_addr_str, http->cmd);
+                   csp->ip_addr_str, http->ocmd);
       }
       else
       {
          rsp = error_response(csp, "connect-failed", errno);
 
          log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 503 0",
-                   csp->ip_addr_str, http->cmd);
+                   csp->ip_addr_str, http->ocmd);
       }
 
 
@@ -981,7 +998,7 @@ static void chat(struct client_state *csp)
                     http->hostport);
 
          log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 503 0",
-                   csp->ip_addr_str, http->cmd);
+                   csp->ip_addr_str, http->ocmd);
 
          rsp = error_response(csp, "connect-failed", errno);
 
@@ -1007,7 +1024,7 @@ static void chat(struct client_state *csp)
        * client, flush the rest, and get out of the way.
        */
       log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 200 2\n",
-                csp->ip_addr_str, http->cmd);
+                csp->ip_addr_str, http->ocmd);
 
       if (write_socket(csp->cfd, CSUCCEED, sizeof(CSUCCEED)-1) < 0)
       {
@@ -1081,7 +1098,7 @@ static void chat(struct client_state *csp)
             log_error(LOG_LEVEL_ERROR, "read from: %s failed: %E", http->host);
 
             log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 503 0",
-                      csp->ip_addr_str, http->cmd);
+                      csp->ip_addr_str, http->ocmd);
 
             rsp = error_response(csp, "connect-failed", errno);
 
@@ -1395,7 +1412,7 @@ static void chat(struct client_state *csp)
    }
 
    log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 200 %d",
-             csp->ip_addr_str, http->cmd, byte_count);
+             csp->ip_addr_str, http->ocmd, byte_count);
 }
 
 
@@ -1485,9 +1502,7 @@ int main(int argc, const char *argv[])
    int argc_pos = 1;
 
    configfile =
-#ifdef AMIGA
-   "AmiTCP:db/junkbuster/config"
-#elif !defined(_WIN32)
+#if !defined(_WIN32)
    "config"
 #else
    "config.txt"
@@ -1564,7 +1579,7 @@ int main(int argc, const char *argv[])
 #endif
 
 
-#if !defined(_WIN32) && !defined(__OS2__)
+#if !defined(_WIN32) && !defined(__OS2__) && !defined(AMIGA)
 {
    int sig;
    struct sigaction action;