6
16
CURLcode res=CURLE_OK;
8
curl = curl_easy_init();
10
/* First set the URL that is about to receive our POST. */
11
curl_easy_setopt(curl, CURLOPT_URL, URL);
13
/* Based on a bug report by Niels van Tongeren on June 29, 2004:
15
A weird situation occurs when request 1 is a POST request and the request
16
2 is a HEAD request. For the POST request we set the CURLOPT_POSTFIELDS,
17
CURLOPT_POSTFIELDSIZE and CURLOPT_POST options. For the HEAD request we
18
set the CURLOPT_NOBODY option to '1'.
22
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "moo");
23
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 3);
24
curl_easy_setopt(curl, CURLOPT_POST, 1);
26
/* this is where transfer 1 would take place, but skip that and change
27
options right away instead */
29
curl_easy_setopt(curl, CURLOPT_NOBODY, 1);
31
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); /* show verbose for debug */
32
curl_easy_setopt(curl, CURLOPT_HEADER, 1); /* include header */
34
/* Now, we should be making a fine HEAD request */
36
/* Perform the request 2, res will get the return code */
37
res = curl_easy_perform(curl);
40
curl_easy_cleanup(curl);
18
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
19
fprintf(stderr, "curl_global_init() failed\n");
20
return TEST_ERR_MAJOR_BAD;
23
if ((curl = curl_easy_init()) == NULL) {
24
fprintf(stderr, "curl_easy_init() failed\n");
25
curl_global_cleanup();
26
return TEST_ERR_MAJOR_BAD;
29
/* First set the URL that is about to receive our POST. */
30
curl_easy_setopt(curl, CURLOPT_URL, URL);
32
/* Based on a bug report by Niels van Tongeren on June 29, 2004:
34
A weird situation occurs when request 1 is a POST request and the request
35
2 is a HEAD request. For the POST request we set the CURLOPT_POSTFIELDS,
36
CURLOPT_POSTFIELDSIZE and CURLOPT_POST options. For the HEAD request we
37
set the CURLOPT_NOBODY option to '1'.
41
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "moo");
42
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 3);
43
curl_easy_setopt(curl, CURLOPT_POST, 1);
45
/* this is where transfer 1 would take place, but skip that and change
46
options right away instead */
48
curl_easy_setopt(curl, CURLOPT_NOBODY, 1);
50
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); /* show verbose for debug */
51
curl_easy_setopt(curl, CURLOPT_HEADER, 1); /* include header */
53
/* Now, we should be making a fine HEAD request */
55
/* Perform the request 2, res will get the return code */
56
res = curl_easy_perform(curl);
59
curl_easy_cleanup(curl);
60
curl_global_cleanup();