caudium-commits AT caudium.net
Caudium CVS Commits list

CVS: caudium/server/modules/vhs vhs_sqllogger.pike,1.1.4.1,1.1.4.2


chronological Thread 
  • From: "Xavier Beaudouin" <kiwi AT cvs.caudiumforge.net>
  • To: caudium-commits AT caudium.net
  • Subject: CVS: caudium/server/modules/vhs vhs_sqllogger.pike,1.1.4.1,1.1.4.2
  • Date: Fri, 6 May 2005 14:39:48 +0000

Update of /cvs/caudium/caudium/server/modules/vhs
In directory cvs.caudiumforge.net:/tmp/cvs-serv90370/server/modules/vhs

Modified Files:
      Tag: stable_1_4
        vhs_sqllogger.pike 
Log Message:
Backport of VHS SQLLogger


Index: vhs_sqllogger.pike
===================================================================
RCS file: /cvs/caudium/caudium/server/modules/vhs/Attic/vhs_sqllogger.pike,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -r1.1.4.1 -r1.1.4.2
--- vhs_sqllogger.pike  6 May 2005 14:02:35 -0000       1.1.4.1
+++ vhs_sqllogger.pike  6 May 2005 14:39:46 -0000       1.1.4.2
@@ -19,7 +19,7 @@
  *
  */
 /*
- * $Id: vhs_sqllogger.pike,v 1.1.4.1 2005/05/06 14:02:35 kiwi Exp $
+ * $Id: vhs_sqllogger.pike,v 1.1.4.2 2005/05/06 14:39:46 kiwi Exp $
  */
 
 #include <module.h>
@@ -35,7 +35,7 @@
                        "apache distribution.";
 constant module_unique= 1;
 constant thread_safe  = 1;
-constant cvs_version  = "$Id: vhs_sqllogger.pike,v 1.1.4.1 2005/05/06 
14:02:35 kiwi Exp $";
+constant cvs_version  = "$Id: vhs_sqllogger.pike,v 1.1.4.2 2005/05/06 
14:39:46 kiwi Exp $";
 
 //
 //! module: SQL logger
@@ -45,7 +45,7 @@
 //! inherits: module
 //! inherits: caudiumlib
 //! type: MODULE_LOGGER
-//! cvs_version: $Id: vhs_sqllogger.pike,v 1.1.4.1 2005/05/06 14:02:35 kiwi 
Exp $
+//! cvs_version: $Id: vhs_sqllogger.pike,v 1.1.4.2 2005/05/06 14:39:46 kiwi 
Exp $
 //
 
 object db;             // The db stack
@@ -78,7 +78,7 @@
     num_dbs=num;
     mixed err;
     for(int i = 0; i < num; i++) {
-      err=catch( dbs += ({ Sql.sql(db_url) }));
+      err=catch( dbs += ({ Sql.Sql(db_url) }));
       if(err) perror("Error creating db object:\n" + 
describe_backtrace(err)+"\n");
     }
   }
@@ -98,7 +98,7 @@
       }
     } else {
       if(!sizeof(dbs)) {
-       d = Sql.sql(db_url);
+       d = Sql.Sql(db_url);
       } else {
        d = dbs[0];
        dbs -= ({d});
@@ -137,15 +137,6 @@
 }
 
 
-nomask private inline string extract_user(string from)
-{
-  array tmp;
-  if (!from || sizeof(tmp = from/":")<2)
-    return "-";
-  
-  return tmp[0];      // username only, no password
-}
-
 void log(object id, mapping file)  {
   string log_query, referer, host;
   array auth;
@@ -161,6 +152,8 @@
     host = (host / ":")[0];
   }
 
+  int|mapping user=id->get_user();
+
   log_query=sprintf("INSERT INTO %s 
(agent,bytes_sent,referer,remote_host,remote_user,"
                     "request_duration,request_method,request_protocol,"
                     
"request_uri,request_args,status,time_stamp,virtual_host) VALUES("
@@ -170,12 +163,12 @@
                    (string)file->len,
                    referer,
                    (string)id->remoteaddr,
-                   extract_user(id->realauth),
+                   (user?user->username:"-"),
                    (string)id->method,
                    (string)id->prot,
                    (string)id->not_query,
                     id->query?sprintf("'?%s'",(string)id->query):"NULL",
-                   (int)(file->error||200),
+                   Logging.unsigned_to_bin(file->error||200),
                    time(),
                    host,
                    );



  • CVS: caudium/server/modules/vhs vhs_sqllogger.pike,1.1.4.1,1.1.4.2, Xavier Beaudouin

Archive powered by MhonArc 2.6.10.

§