I have libcurl built with OpenSSL backend. I want to set SNI to some specified string. the way that I could find is using the function SSL_set_tlsext_host_name
which takes the SSL *
instance and a string and then sets it. (see https://stackoverflow.com/a/5113466/3754125)
However curl_easy does not have a call back to retrieve SSL*
instance. Is there an alternate way to do so?
Some more context:
In my environment, I have to use CURLOPT_RESOLVE
to resolve the FQDN to IPv4.
There is the FQDN: const char *fqdn
IPv4 which fqdn
should resolve to: uint32_t ipv4
fake SNI: const char *sni
The gist looks something like:
CURL *ez;
char buf[ENOUGH];
struct curl_slist *resolver;
/* ... */
snprintf(buf, sizeof(buf), "%s:%d:%d.%d.%d.%d", fqdn, port, IP(IPv4));
resolver = curl_slist_append(NULL, buf);
curl_easy_setopt(ez, CURLOPT_RESOLVE, resolver);
After this I need to set the SNI to the fake SNI without touching the resolver.