Re: [squid-users] Display Client IP & Hostname

From: Frank Fegert <fra.nospam.nk@dont-contact.us>
Date: Sat, 31 Jul 2004 13:53:07 +0200

Hi,

Henrik Nordstrom wrote:
> The client resolving functions is there within Squid, just not used in
> the error page code.
>
> The only implication is that the error page code can not wait for the name
> to be resolved. If not already know by Squid it can not be displayed.
>
> You can play some tricks with http_access to make Squid resolve the client
> name however.

hm, prior to your reply i made the following patch to errorpage.c to
solve the problem:

me@host:./squid-2.5.STABLE4/src# diff errorpage.c errorpage.c_20040622
513,523d512
< 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. From
your experience, would you say this might cause havoc with squid and
should be solved with a different approach?

Thanks & Regards,

        Frank

P.S.: Should "code"-questions preferably be posted to the squid-dev
       list?
Received on Sat Jul 31 2004 - 05:55:34 MDT

This archive was generated by hypermail pre-2.1.9 : Sun Aug 01 2004 - 12:00:03 MDT