[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

patch adding logging of virtual servername



Note, the patch is quite trivial and should maybe be enhanced to allow for
easier parsing of certain cases but it should work for those who need it.
Basically instead of logging /index.html it 'll just log the servername in
front of it.

It does cover cases where people request something in the rootdir without
leading slash. So a GET index.html gets correctly logged as
virtualservername/index.html.

Parsing might be somewhat hard if people also do requests with no hostname
given though it sure beats having no idea what virtualserver the
/index.html refers to ;-)

Dirk Moerenhout ///// System Administrator ///// Planet Internet NV
--- linuxprev/net/tux/logger.c	Fri Aug 24 22:59:16 2001
+++ linux/net/tux/logger.c	Fri Aug 24 22:34:41 2001
@@ -134,6 +134,15 @@
 	uri_len = req->uri_len;
 	len = uri_len + 1;
 
+	if (virtual_server && req->host_len)
+        {
+          len += req->host_len;
+          if (req->uri_str[0] != '/')
+          {
+            len++;
+          }
+        }
+
 	Dprintk("method_str: {%s} [%d]\n", req->method_str, req->method_len);
 	len += req->method_len + 1;
 
@@ -246,6 +255,17 @@
 		CHECK_LOGPTR(str);
 	}
 	*str++ = 0;
+
+        if (virtual_server && req->host_len)
+        {
+          memcpy(str, req->host, req->host_len);
+          str += req->host_len;
+          if (req->uri_str[0] != '/')
+          {
+            *str++ = '/';
+          }
+          CHECK_LOGPTR(str);
+        }
 
 	strncpy(str, req->uri_str, req->uri_len);
 	str += uri_len;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []