*/
FETCH_CALLBACK,
+ /**
+ * Source IP address to bind for a fetch.
+ * Additional argument is a host_t*, which may be NULL.
+ */
+ FETCH_SOURCEIP,
+
/**
* end of fetching options
*/
fetcher_option_t opt;
fetcher_t *fetcher;
bool good = TRUE;
+ host_t *host;
va_list args;
/* check URL support of fetcher */
good = fetcher->set_option(fetcher, opt,
va_arg(args, fetcher_callback_t));
continue;
+ case FETCH_SOURCEIP:
+ host = va_arg(args, host_t*);
+ if (host && !host->is_anyaddr(host))
+ {
+ good = fetcher->set_option(fetcher, opt, host);
+ }
+ continue;
case FETCH_END:
break;
}
this->cb = va_arg(args, fetcher_callback_t);
break;
}
+ case FETCH_SOURCEIP:
+ {
+ char buf[64];
+
+ snprintf(buf, sizeof(buf), "%H", va_arg(args, host_t*));
+ supported = curl_easy_setopt(this->curl, CURLOPT_INTERFACE,
+ buf) == CURLE_OK;
+ break;
+ }
default:
supported = FALSE;
break;