Skip to content

Instantly share code, notes, and snippets.

@bagder
Created June 18, 2018 11:40
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bagder/93092c51fdd5c49a967cc1e641a9f369 to your computer and use it in GitHub Desktop.
Save bagder/93092c51fdd5c49a967cc1e641a9f369 to your computer and use it in GitHub Desktop.
libcurl example using DOH
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://curl.haxx.se/");
curl_easy_setopt(curl, CURLOPT_DOH_URL,
"https://dns.cloudflare.com/.well-known/dns-query");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment