[master] ce0ccf5 Introduce optional resolve arg to std.ip

Dridi Boukelmoune dridi at varni.sh
Wed Jun 13 07:10:01 UTC 2018


> -$Function IP ip(STRING s, IP fallback)
> +$Function IP ip(STRING s, IP fallback, BOOL resolve = 1)
>
>  Description
>         Converts the string *s* to the first IP number returned by
>         the system library function getaddrinfo(3). If conversion
>         fails, *fallback* will be returned.
> +
> +       If *resolve* is true, getaddrinfo() is called using *AI_NUMERICHOST*
> +       to avoid network lookups. This makes "pure" IP strings cheaper to
> +       convert.
> +

Isn't it the other way around?

If *resolve* is false (default is true), getaddrinfo() is called using
*AI_NUMERICHOST* to avoid network lookups. This makes
"pure" IP strings cheaper to convert.

Also, can we make fallback default to the bogo IP in the current
state of things?

Dridi


More information about the varnish-commit mailing list