41
51
struct WriteThis pooh;
54
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
55
fprintf(stderr, "curl_global_init() failed\n");
56
return TEST_ERR_MAJOR_BAD;
59
if ((curl = curl_easy_init()) == NULL) {
60
fprintf(stderr, "curl_easy_init() failed\n");
61
curl_global_cleanup();
62
return TEST_ERR_MAJOR_BAD;
44
65
slist = curl_slist_append(slist, "Transfer-Encoding: chunked");
46
curl = curl_easy_init();
48
/* First set the URL that is about to receive our POST. */
49
curl_easy_setopt(curl, CURLOPT_URL, URL);
51
/* Now specify we want to POST data */
52
curl_easy_setopt(curl, CURLOPT_POST, TRUE);
54
/* we want to use our own read function */
55
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
57
/* pointer to pass to our read function */
58
curl_easy_setopt(curl, CURLOPT_INFILE, &pooh);
60
/* get verbose debug output please */
61
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
63
/* include headers in the output */
64
curl_easy_setopt(curl, CURLOPT_HEADER, TRUE);
66
/* enforce chunked transfer by setting the header */
67
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
69
/* Perform the request, res will get the return code */
70
res = curl_easy_perform(curl);
67
fprintf(stderr, "curl_slist_append() failed\n");
73
68
curl_easy_cleanup(curl);
69
curl_global_cleanup();
70
return TEST_ERR_MAJOR_BAD;
73
/* First set the URL that is about to receive our POST. */
74
curl_easy_setopt(curl, CURLOPT_URL, URL);
76
/* Now specify we want to POST data */
77
curl_easy_setopt(curl, CURLOPT_POST, TRUE);
79
/* we want to use our own read function */
80
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
82
/* pointer to pass to our read function */
83
curl_easy_setopt(curl, CURLOPT_INFILE, &pooh);
85
/* get verbose debug output please */
86
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
88
/* include headers in the output */
89
curl_easy_setopt(curl, CURLOPT_HEADER, TRUE);
91
/* enforce chunked transfer by setting the header */
92
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
94
/* Perform the request, res will get the return code */
95
res = curl_easy_perform(curl);
97
/* clean up the headers list */
78
/* clean up the headers list */
79
99
curl_slist_free_all(slist);
102
curl_easy_cleanup(curl);
103
curl_global_cleanup();