Search squid archive

Re: How to determine if URL in HttpRequest is an Ip address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We are using squid 3.1.6 and every time i access a IP Based URL, i get
1 for GetHostIsNumeric(). There is a limitation from client for
upgradation of the release :(

Searched the net and found that IsAnyAddr() had bugs and Address.cc in
ip was modified.

Applied the patch and modified the functions IsAnyAddr to

bool
Ip::Address::IsAnyAddr() const
{
    return IN6_IS_ADDR_UNSPECIFIED(&m_SocketAddr.sin6_addr) ||
IN6_ARE_ADDR_EQUAL(&m_SocketAddr.sin6_addr, &v4_anyaddr);
}

IsIPv4() to

bool
Ip::Address::IsIPv4() const
{
    return IN6_IS_ADDR_V4MAPPED( &m_SocketAddr.sin6_addr );
}

IsIPv6 to:

bool
Ip::Address::IsIPv6() const
{
    return !IsIPv4();
}

Still i keep on getting 1 for IP Based urls.

Please suggest.

Regards
Sachin

On Wed, Oct 16, 2013 at 10:44 AM, Amos Jeffries <squid3@xxxxxxxxxxxxx> wrote:
> On 16/10/2013 4:13 p.m., Sachin Gupta wrote:
>>
>> Yes. I intent to check the host portion only.
>>
>> In HttpRequest.h, a check is being made:
>>
>>          if ( host_addr.IsAnyAddr() ) {
>>              xstrncpy(host, src, SQUIDHOSTNAMELEN);
>>              host_is_numeric = 0;
>>
>> Does host_addr mean the host part of the destination URL?
>
>
> No. It means the results of attempting to parse the host portion of URL as
> an IP address.
>
> Please use the accessor I mentioned earlier.
>
> Amos




[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux