aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-10-23 14:34:41 +0200
committerDaniel Stenberg <daniel@haxx.se>2014-10-23 14:34:41 +0200
commite116d0a625d82eae43e6e6ba3b68b127afb982c3 (patch)
treed532bf7fced64ffa47f2a654e83b2d40ed0621c9 /docs
parent9f5744a72f2ab7deebac27c39c0962b0f93d82f7 (diff)
CURLOPT_RESOLVE.3: add an example
Diffstat (limited to 'docs')
-rw-r--r--docs/libcurl/opts/CURLOPT_RESOLVE.318
1 files changed, 17 insertions, 1 deletions
diff --git a/docs/libcurl/opts/CURLOPT_RESOLVE.3 b/docs/libcurl/opts/CURLOPT_RESOLVE.3
index a1e82bc7a..06a393a74 100644
--- a/docs/libcurl/opts/CURLOPT_RESOLVE.3
+++ b/docs/libcurl/opts/CURLOPT_RESOLVE.3
@@ -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