Re: [squid-users] How to determine if URL in HttpRequest is an Ip address

From: Sachin Gupta <chingupt_at_gmail.com>
Date: Wed, 16 Oct 2013 16:34:51 +0530

Thanks Amos. Its working fine now.

Regards

On Wed, Oct 16, 2013 at 3:01 PM, Amos Jeffries <squid3_at_treenet.co.nz> wrote:
> Question:
>
>
> On 16/10/2013 4:50 a.m., Sachin Gupta wrote:
>>
>> Is there a way to determine in squid code if the URL being accessed is
>> an Ipaddress?
>
>
> You ask how to identify _whether_ the URL contained numeric IP.
>
>
> Answer:
>
>
> On 16/10/2013 3:48 p.m., Amos Jeffries wrote:
>>
>> You can test the request->GetHostIsNumeric() in the current releases to
>> see if the host portion of the URL is an IP address.
>
>
> "Use GetHostIsNumeric()" is the answer ...
>
>
>
> On 16/10/2013 7:48 p.m., Sachin Gupta wrote:
>>
>> We are using squid 3.1.6 and every time i access a IP Based URL, i get
>> 1 for GetHostIsNumeric().
>
>
> ... because it produces 1 whenever the URL contains a numeric IP as the
> host/domain name.
>
>
> http://example.com/ ---> GetHostIsNumeric() => 0 (false)
>
> http://1.2.3.4/ ---> GetHostIsNumeric() => 1 (true)
>
>
>
> Amos
Received on Wed Oct 16 2013 - 11:05:00 MDT

This archive was generated by hypermail 2.2.0 : Wed Oct 16 2013 - 12:00:05 MDT