]> granicus.if.org Git - curl/commitdiff
CURLOPT_RESOLVE.3: add an example
authorDaniel Stenberg <daniel@haxx.se>
Thu, 23 Oct 2014 12:34:41 +0000 (14:34 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 23 Oct 2014 12:34:41 +0000 (14:34 +0200)
docs/libcurl/opts/CURLOPT_RESOLVE.3

index a1e82bc7a03f398186b804285679b192b6d476f5..06a393a74d2e5a1cdcfcc6c6e5b5f035d65bf3b2 100644 (file)
@@ -57,7 +57,23 @@ NULL
 .SH PROTOCOLS
 All
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl;
+struct curl_slist *host = NULL;
+host = curl_slist_append(NULL, "example.com:80:127.0.0.1");
+
+curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_RESOLVE, host);
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+  res = curl_easy_perform(curl);
+
+  /* always cleanup */
+  curl_easy_cleanup(curl);
+}
+
+curl_slist_free_all(host);
+.fi
 .SH AVAILABILITY
 Added in 7.21.3
 .SH RETURN VALUE