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
38 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"
42 # Verify data after the test has been "shot"
48 GET /we/want/1401 HTTP/1.1
49 Host: %HOSTIP:%HTTPPORT
51 Authorization: Basic ZmFrZTp1c2Vy
53 Cookie: chocolate=chip
55 X-Men: cyclops, iceman
59 # CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
60 # configurations - just ignore them
61 $_ = '' if /CURLOPT_SSL_VERIFYPEER/
62 $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
63 $_ = '' if /CURLOPT_HTTP_VERSION/
65 <file name="log/test1401.c" mode="text">
66 /********* Sample code generated by the curl command line tool **********
67 * All curl_easy_setopt() options are documented at:
68 * https://curl.haxx.se/libcurl/c/curl_easy_setopt.html
69 ************************************************************************/
70 #include <curl/curl.h>
72 int main(int argc, char *argv[])
76 struct curl_slist *slist1;
79 slist1 = curl_slist_append(slist1, "X-Files: Mulder");
80 slist1 = curl_slist_append(slist1, "X-Men: cyclops, iceman");
82 hnd = curl_easy_init();
83 curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
84 curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/1401");
85 curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
86 curl_easy_setopt(hnd, CURLOPT_USERPWD, "fake:user");
87 curl_easy_setopt(hnd, CURLOPT_HTTPAUTH, (long)CURLAUTH_BASIC);
88 curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist1);
89 curl_easy_setopt(hnd, CURLOPT_USERAGENT, "MyUA");
90 curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
91 curl_easy_setopt(hnd, CURLOPT_COOKIE, "chocolate=chip");
92 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
93 curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
94 curl_easy_setopt(hnd, CURLOPT_PROTOCOLS, (long)CURLPROTO_FILE |
96 (long)CURLPROTO_HTTP);
98 /* Here is a list of options the curl code used that cannot get generated
99 as source easily. You may select to either not use them or implement
102 CURLOPT_WRITEDATA set to a objectpointer
103 CURLOPT_INTERLEAVEDATA set to a objectpointer
104 CURLOPT_WRITEFUNCTION set to a functionpointer
105 CURLOPT_READDATA set to a objectpointer
106 CURLOPT_READFUNCTION set to a functionpointer
107 CURLOPT_SEEKDATA set to a objectpointer
108 CURLOPT_SEEKFUNCTION set to a functionpointer
109 CURLOPT_ERRORBUFFER set to a objectpointer
110 CURLOPT_STDERR set to a objectpointer
111 CURLOPT_DEBUGFUNCTION set to a functionpointer
112 CURLOPT_DEBUGDATA set to a objectpointer
113 CURLOPT_HEADERFUNCTION set to a functionpointer
114 CURLOPT_HEADERDATA set to a objectpointer
118 ret = curl_easy_perform(hnd);
120 curl_easy_cleanup(hnd);
122 curl_slist_free_all(slist1);
127 /**** End of sample code ****/