hickory-dns / resolv-conf

The /etc/resolv.conf file parser in rust
Apache License 2.0
27 stars 25 forks source link

No way to ignore invalid directives #17

Open philgebhardt opened 5 years ago

philgebhardt commented 5 years ago

Background It's not ideal, but sometimes linux systems have invalid directives in their resolv.conf. Often (perhaps always) this is due to typos. Utilities like curl, dig, host, are resilient to these invalid directives in that if they fail to parse them, they are ignored, allowing for effective resolution in spite of them.

Problem This crate is used by common utilities for making http requests. As such, when an invalid directive is found in resolv.conf, all http requests stop working.

Reproduce Withthe contents of a resolv.conf configuration

nope
nameserver 192.168.65.1

try to execute grammar::parse with it's contents, this yields an Err(InvalidDirective(line))

Solution Provide a way to ignore these invalid directives, perhaps via a feature flag like #[cfg(feature="no-strict")]

philgebhardt commented 5 years ago

I've supplied a solution for this: https://github.com/tailhook/resolv-conf/pull/18