----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files. Don't make us guess your problem!!!
----------------------------------------------------------------
Ok, so I tracked it down.
the r->connection->remote_host is NULL from all the way back at
jserv_handler_servlet(..) so I think that using r->connection->remote_host is not the
way to do it.
This is further reinforced by the comment in the httpd.h file:
In /usr/lib/apache/httpd.h (apache 1.3.6), I find the following comment on line 804:
char *remote_host; /* Client's DNS name, if known.
* NULL if DNS hasn't been checked,
* NULL if it has and no address was found.
* N.B. Only access this through
get_remote_host() */
In fact when I my hack code to the following:
(this is in jserv_ajpv12.c at roughly line 532)
{
char tyler_buf[256];
strcpy( tyler_buf, "Tyler Asks Remote Host Name: " );
if ( r->connection->remote_host == NULL )
strcat( tyler_buf, " remote host is NULL !! " );
else
strcat ( tyler_buf, r->connection->remote_host );
strcat (tyler_buf, " and get_host_name says: " );
// IMPORTANT NOTE: I have ZERO idea if "r->per_dir_config" is the correct
thing to use.
// I also have ZERO idea if "REMOTE_HOST" is what we want to use here....
strcat( tyler_buf, ap_get_remote_host( r->connection, r->per_dir_config,
REMOTE_HOST ) );
jserv_error( JSERV_LOG_EMERG, cfg, tyler_buf );
}
When I do this, I get the host name in the log.
BUT I also get something pretty odd... The HostNameServlet works when I've just called
the ap_get_remote_host() above the code that passes the r->connection->remote_host
into the servlet... very weird because it's invalid on the next request before I call
ap_get_remote_host(..) again.
SO, it looks like if a call to ap_get_remote_host(...) is added just before the
existing code, the existing code will work. However, given the comment in httpd.h
about only accessing remote_host via get_remote_host(), perhaps that should be used
directly in the call to send the remote host name to the socket, something like:
ajpv12_sendstring( buffsocket, ap_get_remote_host(...) );
this is at roughly line 537 +/- (I hacked my file too badly to give you an exact line
number.. yes I know, I should have backed it up first! oops... :-).
Hopefully someone who knows more than I can put in this fix and knows what to use for
the void *dir_config param of ap_get_remote_host(...). I might suggest that JServ
use the same or similar parameters to whatever mod_perl does? but I'm way outa my
league here and I know it.
Hope this helps.
peace,
Tyler
>Actually, It looks like turning on HostnameLookups in httpd.conf made the test2.pl
>script in the previous post work, but NOT the HostNameServlet.
>
>
>The location in the apj12.c code still shows that the r->connection->remote_host is
>NULL. Now I'll go figure out why.
>
>Sorry,
>Tyler
------------------------------------------------------
Tyler Morrison - [EMAIL PROTECTED]
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]