17 Date: Thu, 29 Jul 2008 14:49:00 GMT
18 Server: test-server/fake
20 Content-Type: text/plain
32 --libcurl for GET with various options
35 http://%HOSTIP:%HTTPPORT/we/want/1401 --libcurl log/test1401.c --basic -u fake:user -H "X-Files: Mulder" -H "X-Men: cyclops, iceman" -A MyUA -b chocolate=chip --proto "=http,ftp,file"
39 # Verify data after the test has been "shot"
45 GET /we/want/1401 HTTP/1.1
\r
46 Host: %HOSTIP:%HTTPPORT
\r
47 User-Agent: stripped
\r
48 Authorization: Basic ZmFrZTp1c2Vy
\r
50 Cookie: chocolate=chip
\r
52 X-Men: cyclops, iceman
\r
56 # CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
57 # configurations - just ignore them
58 $_ = '' if /CURLOPT_SSL_VERIFYPEER/
59 $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
60 $_ = '' if /CURLOPT_HTTP_VERSION/
62 <file name="log/test1401.c" mode="text">
63 /********* Sample code generated by the curl command line tool **********
64 * All curl_easy_setopt() options are documented at:
65 * https://curl.haxx.se/libcurl/c/curl_easy_setopt.html
66 ************************************************************************/
67 #include <curl/curl.h>
69 int main(int argc, char *argv[])
73 struct curl_slist *slist1;
76 slist1 = curl_slist_append(slist1, "X-Files: Mulder");
77 slist1 = curl_slist_append(slist1, "X-Men: cyclops, iceman");
79 hnd = curl_easy_init();
80 curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/1401");
81 curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
82 curl_easy_setopt(hnd, CURLOPT_USERPWD, "fake:user");
83 curl_easy_setopt(hnd, CURLOPT_USERAGENT, "MyUA");
84 curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist1);
85 curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
86 curl_easy_setopt(hnd, CURLOPT_HTTPAUTH, (long)CURLAUTH_BASIC);
87 curl_easy_setopt(hnd, CURLOPT_COOKIE, "chocolate=chip");
88 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
89 curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
90 curl_easy_setopt(hnd, CURLOPT_PROTOCOLS, (long)CURLPROTO_FILE |
92 (long)CURLPROTO_HTTP);
94 /* Here is a list of options the curl code used that cannot get generated
95 as source easily. You may select to either not use them or implement
98 CURLOPT_WRITEDATA set to a objectpointer
99 CURLOPT_WRITEFUNCTION set to a functionpointer
100 CURLOPT_READDATA set to a objectpointer
101 CURLOPT_READFUNCTION set to a functionpointer
102 CURLOPT_SEEKDATA set to a objectpointer
103 CURLOPT_SEEKFUNCTION set to a functionpointer
104 CURLOPT_ERRORBUFFER set to a objectpointer
105 CURLOPT_STDERR set to a objectpointer
106 CURLOPT_DEBUGFUNCTION set to a functionpointer
107 CURLOPT_DEBUGDATA set to a objectpointer
108 CURLOPT_HEADERFUNCTION set to a functionpointer
109 CURLOPT_HEADERDATA set to a objectpointer
113 ret = curl_easy_perform(hnd);
115 curl_easy_cleanup(hnd);
117 curl_slist_free_all(slist1);
122 /**** End of sample code ****/