pier 01/07/12 18:12:49
Modified: webapp/apache-1.3 mod_webapp.c
Log:
Added a generic per-server callback for the WebApp Library to enable
proper logging.
Fixed port-number translation (Thanks to Thom Park at Borland for noticing)
Revision Changes Path
1.18 +19 -4 jakarta-tomcat-connectors/webapp/apache-1.3/mod_webapp.c
Index: mod_webapp.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/apache-1.3/mod_webapp.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- mod_webapp.c 2001/07/09 22:00:24 1.17
+++ mod_webapp.c 2001/07/13 01:12:44 1.18
@@ -57,7 +57,7 @@
/**
* @author Pier Fumagalli <mailto:[EMAIL PROTECTED]>
- * @version $Id: mod_webapp.c,v 1.17 2001/07/09 22:00:24 pier Exp $
+ * @version $Id: mod_webapp.c,v 1.18 2001/07/13 01:12:44 pier Exp $
*/
#include <httpd.h>
@@ -79,6 +79,8 @@
static wa_boolean wam_initialized=FALSE;
/* The list of configured connections */
static wa_chain *wam_connections=NULL;
+/* The main server using for logging error not related to requests */
+static server_rec *server=NULL;
/* ************************************************************************* */
/* MODULE AND LIBRARY INITIALIZATION AND DESTRUCTION */
@@ -87,6 +89,7 @@
/* Startup the module and the WebApp Library */
static void wam_startup(server_rec *s, pool *p) {
if (!wam_initialized) return;
+ server=s;
wa_startup();
}
@@ -253,9 +256,21 @@
};
/* ************************************************************************* */
-/* CALLBACKS FROM WEB SERVER */
+/* CALLBACKS TO WEB SERVER */
/* ************************************************************************* */
+/* Log a generic error */
+void wa_log(const char *f, const int l, const char *fmt, ...) {
+ va_list ap;
+ char buf[1024];
+
+ va_start(ap,fmt);
+ apr_vsnprintf(buf,1024,fmt,ap);
+ va_end(ap);
+
+ ap_log_error(f,l,APLOG_NOERRNO|APLOG_ERR,server,"%s",buf);
+}
+
/* Log a message associated with a request */
void wam_handler_log(wa_request *r, const char *f, const int l, char *msg) {
request_rec *req=(request_rec *)r->data;
@@ -424,8 +439,8 @@
req->clnt->host=apr_pstrdup(req->pool,ctmp);
req->serv->addr=apr_pstrdup(req->pool,con->local_ip);
req->clnt->addr=apr_pstrdup(req->pool,con->remote_ip);
- req->serv->port=con->local_addr.sin_port;
- req->clnt->port=con->remote_addr.sin_port;
+ req->serv->port=ntohs(con->local_addr.sin_port);
+ req->clnt->port=ntohs(con->remote_addr.sin_port);
/* Set up all other members of the request structure */
req->meth=apr_pstrdup(req->pool,(char *)r->method);