Fixed CLF logging: Now uses client's original HTTP request
authoroes <oes@users.sourceforge.net>
Sun, 3 Mar 2002 14:49:11 +0000 (14:49 +0000)
committeroes <oes@users.sourceforge.net>
Sun, 3 Mar 2002 14:49:11 +0000 (14:49 +0000)
jcc.c

diff --git a/jcc.c b/jcc.c
index 3ec4219..f804bf9 100644 (file)
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.63 2002/03/02 04:14:50 david__schmidt Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.64 2002/03/03 09:18:03 joergs Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -33,6 +33,9 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.63 2002/03/02 04:14:50 david__schmidt Exp
  *
  * Revisions   :
  *    $Log: jcc.c,v $
+ *    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
  *
@@ -782,6 +785,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.
@@ -900,7 +913,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);
@@ -933,14 +946,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);
       }
 
 
@@ -984,7 +997,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);
 
@@ -1010,7 +1023,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)
       {
@@ -1084,7 +1097,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);
 
@@ -1398,7 +1411,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);
 }