aboutsummaryrefslogtreecommitdiff
path: root/lib/hostip.c
diff options
context:
space:
mode:
authorFrancisco Sedano <fran@fransedano.net>2018-02-14 17:20:43 +0000
committerJay Satiro <raysatiro@yahoo.com>2018-02-21 21:29:10 -0500
commit23713645d4e9ae00a3065f7a3d995e57748da4c7 (patch)
treef0add953900167057056308a77ef9ba8ac6228a6 /lib/hostip.c
parentdd027c80fe444e9555ad324ddf8e461eb358f4a3 (diff)
url: Add option CURLOPT_RESOLVER_START_FUNCTION
- Add new option CURLOPT_RESOLVER_START_FUNCTION to set a callback that will be called every time before a new resolve request is started (ie before a host is resolved) with a pointer to backend-specific resolver data. Currently this is only useful for ares. - Add new option CURLOPT_RESOLVER_START_DATA to set a user pointer to pass to the resolver start callback. Closes https://github.com/curl/curl/pull/2311
Diffstat (limited to 'lib/hostip.c')
-rw-r--r--lib/hostip.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/hostip.c b/lib/hostip.c
index 895c13294..8554d39d1 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -58,6 +58,7 @@
#include "strerror.h"
#include "url.h"
#include "inet_ntop.h"
+#include "multiif.h"
#include "warnless.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -481,6 +482,17 @@ int Curl_resolv(struct connectdata *conn,
if(!Curl_ipvalid(conn))
return CURLRESOLV_ERROR;
+ /* notify the resolver start callback */
+ if(data->set.resolver_start) {
+ int st;
+ Curl_set_in_callback(data, true);
+ st = data->set.resolver_start(data->state.resolver, NULL,
+ data->set.resolver_start_client);
+ Curl_set_in_callback(data, false);
+ if(st)
+ return CURLRESOLV_ERROR;
+ }
+
/* If Curl_getaddrinfo() returns NULL, 'respwait' might be set to a
non-zero value indicating that we need to wait for the response to the
resolve call */