MEDIUM: resolvers: create a "default" resolvers section at startup

Try to create a "default" resolvers section at startup, but does not
display any error nor warning. This section is initialized using the
/etc/resolv.conf of the system.

This is opportunistic and with no guarantee that it will work (but it should
on most systems).

This is useful for the httpclient as it allows to use the DNS resolver
without any configuration in most of the cases.

The function is called from the httpclient_pre_check() function to
ensure than we tried to create the section before trying to initiate the
httpclient. But it is also called from the resolvers.c to ensure the
section is created when the httpclient init was disabled.
diff --git a/src/resolvers.c b/src/resolvers.c
index 4634b55..7cbddef 100644
--- a/src/resolvers.c
+++ b/src/resolvers.c
@@ -3628,6 +3628,25 @@
 	free(warnmsg);
 	return err_code;
 }
+
+/* try to create a "default" resolvers section which uses "/etc/resolv.conf"
+ *
+ * This function is opportunistic and does not try to display errors or warnings.
+ */
+int resolvers_create_default()
+{
+	int err_code = 0;
+
+	if (find_resolvers_by_id("default"))
+		return 0;
+
+	err_code |= resolvers_new(&curr_resolvers, "default", "<internal>", 0);
+	if (!(err_code & ERR_CODE))
+		err_code |= parse_resolve_conf(NULL, NULL);
+
+	return 0;
+}
+
 int cfg_post_parse_resolvers()
 {
 	int err_code = 0;
@@ -3658,3 +3677,4 @@
 REGISTER_CONFIG_SECTION("resolvers",      cfg_parse_resolvers, cfg_post_parse_resolvers);
 REGISTER_POST_DEINIT(resolvers_deinit);
 REGISTER_CONFIG_POSTPARSER("dns runtime resolver", resolvers_finalize_config);
+REGISTER_PRE_CHECK(resolvers_create_default);