Addes OOM handling for curl_easy_setopt() calls in test

This commit is contained in:
Yang Tse
2010-02-05 18:07:19 +00:00
parent 12d01bc5f7
commit cad9c3f55f
50 changed files with 744 additions and 439 deletions

View File

@@ -38,29 +38,31 @@ int test(char *URL)
}
/* First set the URL that is about to receive our POST. */
curl_easy_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_URL, URL);
/* Now specify we want to POST data */
curl_easy_setopt(curl, CURLOPT_POST, 1L);
test_setopt(curl, CURLOPT_POST, 1L);
/* Set the expected POST size */
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 1L);
test_setopt(curl, CURLOPT_POSTFIELDSIZE, 1L);
/* we want to use our own read function */
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
test_setopt(curl, CURLOPT_READFUNCTION, read_callback);
/* pointer to pass to our read function */
curl_easy_setopt(curl, CURLOPT_INFILE, NULL);
test_setopt(curl, CURLOPT_INFILE, NULL);
/* get verbose debug output please */
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
/* include headers in the output */
curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
test_setopt(curl, CURLOPT_HEADER, 1L);
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
test_cleanup:
/* always cleanup */
curl_easy_cleanup(curl);
curl_global_cleanup();