When I put up an AOLserver 4 instance with host-based virtual servers, I found that when the Nimda-infected folks came looking for /default.ida+NNNNNN... on virtual host "www.worm.com", the AOLserver would never close the connection because NsQueueConn would always return 0 without doing any work, so the conn couldn't be closed, but it was never processed. After scouting for a fix, I thought the best way to fix it would be to assign a first defined virtual server to be the "default" virtual server, which will get those conns if no other Host header matches. I think this is reasonable, because it allows you to do things like logging these connections, or returning targeted responses when they are encountered -- if the conn is just closed, then the traces aren't run, so no logging occurs, and you can't catch the conn. I think assigning the conn to a default server is probably better than just closing it.
I thought about providing a config directive to assign the default server, but I decided that using the first server defined in the "ns/servers" section is just as flexible. If this is acceptable, I'd be willing to augment the config doc with a description of the behavior. I've tested this patch on my server, and it appears to work. Here's my simple patch: diff -ur --exclude=CVS aolserver/nsd/nsd.h aolserver-vsfix/nsd/nsd.h --- aolserver/nsd/nsd.h Tue Oct 29 19:01:51 2002 +++ aolserver-vsfix/nsd/nsd.h Mon Jan 13 21:33:47 2003 @@ -110,6 +110,8 @@ typedef int bool; +struct NsServer; + struct _nsconf { char *argv0; char *nsd; @@ -131,6 +133,7 @@ */ Tcl_HashTable servertable; + struct NsServer *defaultserver; Tcl_DString servers; /* @@ -261,8 +264,6 @@ * The following structure maitains data for each instance of * a driver initialized with Ns_DriverInit. */ - -struct NsServer; typedef struct Driver { diff -ur --exclude=CVS aolserver/nsd/queue.c aolserver-vsfix/nsd/queue.c --- aolserver/nsd/queue.c Tue Oct 29 19:02:06 2002 +++ aolserver-vsfix/nsd/queue.c Mon Jan 13 21:39:21 2003 @@ -244,10 +244,9 @@ servPtr = Tcl_GetHashValue(hPtr); } } -fprintf(stderr, "%s %p\n", host, servPtr); } if (servPtr == NULL) { - return 0; + servPtr = nsconf.defaultserver; } /* diff -ur --exclude=CVS aolserver/nsd/server.c aolserver-vsfix/nsd/server.c --- aolserver/nsd/server.c Tue Oct 29 19:02:13 2002 +++ aolserver-vsfix/nsd/server.c Mon Jan 13 21:35:39 2003 @@ -125,6 +125,9 @@ hPtr = Tcl_FirstHashEntry(&nsconf.servertable, &search); while (hPtr != NULL) { servPtr = Tcl_GetHashValue(hPtr); + if (nsconf.defaultserver == NULL) { + nsconf.defaultserver = servPtr; + } NsStartServer(servPtr); hPtr = Tcl_NextHashEntry(&search); }