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 User-Agent: stripped
\r
47 Authorization: Basic ZmFrZTp1c2Vy
\r
48 Host: %HOSTIP:%HTTPPORT
\r
50 Cookie: chocolate=chip
\r
52 X-Men: cyclops, iceman
\r
56 # CURLOPT_SSL_VERIFYPEER and SSH_KNOWNHOSTS vary with configurations - just
58 $_ = '' if /CURLOPT_SSL_VERIFYPEER/
59 $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
61 <file name="log/test1401.c" mode="text">
62 /********* Sample code generated by the curl command line tool **********
63 * All curl_easy_setopt() options are documented at:
64 * http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
65 ************************************************************************/
66 #include <curl/curl.h>
68 int main(int argc, char *argv[])
72 struct curl_slist *slist1;
75 slist1 = curl_slist_append(slist1, "X-Files: Mulder");
76 slist1 = curl_slist_append(slist1, "X-Men: cyclops, iceman");
78 hnd = curl_easy_init();
79 curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/1401");
80 curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
81 curl_easy_setopt(hnd, CURLOPT_USERPWD, "fake:user");
82 curl_easy_setopt(hnd, CURLOPT_USERAGENT, "MyUA");
83 curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist1);
84 curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
85 curl_easy_setopt(hnd, CURLOPT_HTTPAUTH, (long)CURLAUTH_BASIC);
86 curl_easy_setopt(hnd, CURLOPT_COOKIE, "chocolate=chip");
87 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
88 curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
89 curl_easy_setopt(hnd, CURLOPT_PROTOCOLS, (long)CURLPROTO_FILE |
91 (long)CURLPROTO_HTTP);
93 /* Here is a list of options the curl code used that cannot get generated
94 as source easily. You may select to either not use them or implement
97 CURLOPT_WRITEDATA set to a objectpointer
98 CURLOPT_WRITEFUNCTION set to a functionpointer
99 CURLOPT_READDATA set to a objectpointer
100 CURLOPT_READFUNCTION set to a functionpointer
101 CURLOPT_SEEKDATA set to a objectpointer
102 CURLOPT_SEEKFUNCTION set to a functionpointer
103 CURLOPT_ERRORBUFFER set to a objectpointer
104 CURLOPT_STDERR set to a objectpointer
105 CURLOPT_DEBUGFUNCTION set to a functionpointer
106 CURLOPT_DEBUGDATA set to a objectpointer
107 CURLOPT_HEADERFUNCTION set to a functionpointer
108 CURLOPT_HEADERDATA set to a objectpointer
112 ret = curl_easy_perform(hnd);
114 curl_easy_cleanup(hnd);
116 curl_slist_free_all(slist1);
121 /**** End of sample code ****/