summaryrefslogtreecommitdiff
path: root/libstd/resolve.myr
diff options
context:
space:
mode:
Diffstat (limited to 'libstd/resolve.myr')
-rw-r--r--libstd/resolve.myr20
1 files changed, 16 insertions, 4 deletions
diff --git a/libstd/resolve.myr b/libstd/resolve.myr
index 5653338..3a4fc42 100644
--- a/libstd/resolve.myr
+++ b/libstd/resolve.myr
@@ -116,6 +116,7 @@ const loadhosts = {
/* trim comment */
match strfind(l, "#")
| `Some idx: l = l[:idx]
+ | `None: /* whole line */
;;
match word(l)
@@ -123,6 +124,12 @@ const loadhosts = {
match ipparse(ip)
| `Some addr:
addhosts(addr, ip, rest)
+ | `None:
+ /*
+ invalid addresses are ignored: we don't want to break stuff
+ with invalid or unsupported addresses
+ */
+
;;
| `None:
;;
@@ -175,10 +182,12 @@ const loadresolv = {
;;
match word(l)
- | `Some (cmd, rest):
- if sleq(cmd, "nameserver")
- addns(rest)
- ;;
+ | `Some ("nameserver", srv):
+ addns(srv)
+ | `Some (_, rest):
+ /* invalid or unrecognized commands */
+ | `None:
+ /* unrecognized lines */
;;
;;
slfree(lines)
@@ -191,7 +200,10 @@ const addns = {rest
| `Some addr:
nameservers = slpush(nameservers, addr)
| `None:
+ /* nothing */
;;
+ | `None:
+ /* nothing */
;;
}