14 Date: Thu, 29 Jul 2008 14:49:00 GMT
15 Server: test-server/fake
17 Content-Type: text/plain
29 --libcurl for simple POST
32 http://%HOSTIP:%HTTPPORT/we/want/1402 --libcurl log/test1402.c -d "foo=bar" -d "baz=quux"
36 # Verify data after the test has been "shot"
41 <protocol nonewline="yes">
42 POST /we/want/1402 HTTP/1.1
\r
43 User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 zlib/1.1.4
\r
44 Host: %HOSTIP:%HTTPPORT
\r
47 Content-Type: application/x-www-form-urlencoded
\r
52 # curl's default user-agent varies with version, libraries etc.
53 s/(USERAGENT, \")[^\"]+/${1}stripped/
54 # CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
55 # configurations - just ignore them
56 $_ = '' if /CURLOPT_SSL_VERIFYPEER/
57 $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
58 $_ = '' if /CURLOPT_HTTP_VERSION/
60 <file name="log/test1402.c" mode="text">
61 /********* Sample code generated by the curl command line tool **********
62 * All curl_easy_setopt() options are documented at:
63 * https://curl.haxx.se/libcurl/c/curl_easy_setopt.html
64 ************************************************************************/
65 #include <curl/curl.h>
67 int main(int argc, char *argv[])
72 hnd = curl_easy_init();
73 curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/1402");
74 curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
75 curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "foo=bar&baz=quux");
76 curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)16);
77 curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
78 curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
79 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
80 curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
82 /* Here is a list of options the curl code used that cannot get generated
83 as source easily. You may select to either not use them or implement
86 CURLOPT_WRITEDATA set to a objectpointer
87 CURLOPT_INTERLEAVEDATA set to a objectpointer
88 CURLOPT_WRITEFUNCTION set to a functionpointer
89 CURLOPT_READDATA set to a objectpointer
90 CURLOPT_READFUNCTION set to a functionpointer
91 CURLOPT_SEEKDATA set to a objectpointer
92 CURLOPT_SEEKFUNCTION set to a functionpointer
93 CURLOPT_ERRORBUFFER set to a objectpointer
94 CURLOPT_STDERR set to a objectpointer
95 CURLOPT_DEBUGFUNCTION set to a functionpointer
96 CURLOPT_DEBUGDATA set to a objectpointer
97 CURLOPT_HEADERFUNCTION set to a functionpointer
98 CURLOPT_HEADERDATA set to a objectpointer
102 ret = curl_easy_perform(hnd);
104 curl_easy_cleanup(hnd);
109 /**** End of sample code ****/