Midori.URI.is_ip_address looks to be pretty rudimentary and has a lot of heuristics which are neither obvious nor explained. Its specific purpose should be documented, or it should be fixed to match what its name implies, as specified by the relevant Internet standards documents.
Some cases which are broken:
midori_uri_is_ip_address("@999.@999.@999.@999.@999.@999.") => TRUE
midori_uri_is_ip_address("127...1") => TRUE
midori_uri_is_ip_address("127.1.1.1.1") => TRUE
midori_uri_is_ip_address("::1") => FALSE
midori_uri_is_ip_address("0.0.0.0") => FALSE
midori_uri_is_ip_address("0177.0.0.1") => FALSE
midori_uri_is_ip_address("2130706433") => FALSE
midori_uri_is_ip_address("017700000001") => FALSE
The purpose of Midori. URI.is_ ip_address is to "quickly determine if the input resembles an IP". uri_is_ ip_address( "@999.@ 999.@999. @999.@999. @999.") => TRUE uri_is_ ip_address( "127... 1") => TRUE uri_is_ ip_address( "127.1. 1.1.1") => TRUE
> midori_
> midori_
> midori_
Those look like IPs to me, likely typos, showing an error is more useful here than doing a web search.
> midori_ uri_is_ ip_address( "::1") => FALSE
Should say TRUE indeed.
> midori_ uri_is_ ip_address( "0.0.0. 0") => FALSE uri_is_ ip_address( "0177.0. 0.1") => FALSE
> midori_
Those should probably return TRUE being typos intended as IPs.
> midori_ uri_is_ ip_address( "2130706433" ) => FALSE uri_is_ ip_address( "017700000001" ) => FALSE
> midori_
Does any spec consider these IPs? They look like phone numbers to me.
I sort of consider the unit tests as the examples since they're based off of real life strings from bug reports and elsewhere. Though I suppose some examples could be added to the Midori.URI docs as well.