On Sat, 31 Jul 2004, Frank Fegert wrote:
> < case 'n':
> < /* resolv client hostname. */
> < printf(" ");
> < struct hostent *hp_new = NULL;
> < struct in_addr addr;
> <
> < addr.s_addr = inet_addr(inet_ntoa(err->src_addr));
> < hp_new = gethostbyaddr((char *) &addr, 4, AF_INET);
> <
> < memBufPrintf(&mb, "%s", hp_new->h_name);
> < break;
>
>
> Admittedly it's a quick and dirty hack, but it seems to work.
It works fine as long as there is no problem resolving a client IP
address. If there is problems then your Squid will hang completely stop
processing requests (both ongoing and new) until the DNS lookup times out.
> From your experience, would you say this might cause havoc with squid
> and should be solved with a different approach?
You should be using the DNS functions of Squid, not gethostbyname. The
problem then is that Squid will not wait for the DNS lookup to complete
and the hostname will only be shown if already known to Squid.
> P.S.: Should "code"-questions preferably be posted to the squid-dev
> list?
Indeed.
Regards
Henrik
Received on Tue Aug 03 2004 - 14:10:45 MDT
This archive was generated by hypermail pre-2.1.9 : Wed Sep 01 2004 - 12:00:01 MDT