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]

 



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




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

  Powered by Linux