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 08:43:42 +0530

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?

Regards

On Wed, Oct 16, 2013 at 8:18 AM, Amos Jeffries <squid3_at_treenet.co.nz> wrote:
> On 16/10/2013 4:50 a.m., Sachin Gupta wrote:
>>
>> Hi,
>>
>> I have the HttpRequest object from which urlPath can be found.
>> Is there a way to determine in squid code if the URL being accessed is
>> an Ipaddress?
>>
>> Regards
>
>
> Full-URL is never an IP address. It may contain one. But there is also
> scheme and optional /path ?query-string and #fragment sections to btaken
> into account.
>
> You can test the request->GetHostIsNumeric() in the current releases to see
> if the host portion of the URL is an IP address.
>
> Amos
Received on Wed Oct 16 2013 - 03:13:50 MDT

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