Index: libhttpd.c =================================================================== RCS file: /work/jeff519/cvsroot/thttpd/libhttpd.c,v retrieving revision 1.1 retrieving revision 1.6 diff -u -b -B -w -r1.1 -r1.6 --- libhttpd.c 15 Apr 2002 00:38:12 -0000 1.1 +++ libhttpd.c 22 Apr 2002 00:53:09 -0000 1.6 @@ -50,6 +50,8 @@ #include #include +#include "../host_info.h" + #ifdef HAVE_DIRENT_H # include # define NAMLEN(dirent) strlen((dirent)->d_name) @@ -1176,7 +1178,10 @@ #endif /* VHOST_DIRLEVELS */ /* Figure out the virtual hostname. */ - if ( hc->reqhost[0] != '\0' ) + // XXX + if ( hc->opthost[0] != '\0' ) + hc->hostname = hc->opthost; + else if ( hc->reqhost[0] != '\0' ) hc->hostname = hc->reqhost; else if ( hc->hdrhost[0] != '\0' ) hc->hostname = hc->hdrhost; @@ -1456,6 +1461,7 @@ { httpd_sockaddr sa; int sz; + socklen_t optlen = TCP_MAX_HOST_LEN; if ( ! hc->initialized ) { @@ -1503,6 +1509,16 @@ return GC_FAIL; } (void) fcntl( hc->conn_fd, F_SETFD, 1 ); + + // XXX + hc->opthost = NEW (char, optlen); + if ( getsockopt(hc->conn_fd, SOL_TCP, TCP_HOSTS, hc->opthost, &optlen) < 0) { + hc->opthost = RENEW( hc->opthost, char, 1 ); + optlen = 0; + } + hc->opthost[optlen] = '\0'; + + hc->hs = hs; memset( &hc->client_addr, 0, sizeof(hc->client_addr) ); memcpy( &hc->client_addr, &sa, sockaddr_len( &sa ) ); Index: libhttpd.h =================================================================== RCS file: /work/jeff519/cvsroot/thttpd/libhttpd.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -B -w -r1.1 -r1.2 --- libhttpd.h 15 Apr 2002 00:38:12 -0000 1.1 +++ libhttpd.h 15 Apr 2002 03:11:02 -0000 1.2 @@ -107,6 +107,8 @@ char* contenttype; char* reqhost; char* hdrhost; + // XXX + char* opthost; char* hostdir; char* authorization; char* remoteuser;