aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/lib547.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2010-02-05 18:07:19 +0000
committerYang Tse <yangsita@gmail.com>2010-02-05 18:07:19 +0000
commitcad9c3f55fad5da988144dc83ad76a8544a071a2 (patch)
tree9231f49bc11dfdb69b4cac9af3b1dd473d1507ad /tests/libtest/lib547.c
parent12d01bc5f72c4c0f9aabfa45628d9c4702491fb0 (diff)
Addes OOM handling for curl_easy_setopt() calls in test
Diffstat (limited to 'tests/libtest/lib547.c')
-rw-r--r--tests/libtest/lib547.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/tests/libtest/lib547.c b/tests/libtest/lib547.c
index a8f73eb5f..ba81b49c4 100644
--- a/tests/libtest/lib547.c
+++ b/tests/libtest/lib547.c
@@ -84,29 +84,31 @@ int test(char *URL)
return TEST_ERR_MAJOR_BAD;
}
- curl_easy_setopt(curl, CURLOPT_URL, URL);
- curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
- curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
+ test_setopt(curl, CURLOPT_URL, URL);
+ test_setopt(curl, CURLOPT_VERBOSE, 1L);
+ test_setopt(curl, CURLOPT_HEADER, 1L);
#ifdef LIB548
/* set the data to POST with a mere pointer to a zero-terminated string */
- curl_easy_setopt(curl, CURLOPT_POSTFIELDS, UPLOADTHIS);
+ test_setopt(curl, CURLOPT_POSTFIELDS, UPLOADTHIS);
#else
/* 547 style, which means reading the POST data from a callback */
- curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctlcallback);
- curl_easy_setopt(curl, CURLOPT_IOCTLDATA, &counter);
- curl_easy_setopt(curl, CURLOPT_READFUNCTION, readcallback);
- curl_easy_setopt(curl, CURLOPT_READDATA, &counter);
+ test_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctlcallback);
+ test_setopt(curl, CURLOPT_IOCTLDATA, &counter);
+ test_setopt(curl, CURLOPT_READFUNCTION, readcallback);
+ test_setopt(curl, CURLOPT_READDATA, &counter);
/* We CANNOT do the POST fine without setting the size (or choose chunked)! */
- curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(UPLOADTHIS));
+ test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(UPLOADTHIS));
#endif
- curl_easy_setopt(curl, CURLOPT_POST, 1L);
- curl_easy_setopt(curl, CURLOPT_PROXY, libtest_arg2);
- curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, libtest_arg3);
- curl_easy_setopt(curl, CURLOPT_PROXYAUTH,
+ test_setopt(curl, CURLOPT_POST, 1L);
+ test_setopt(curl, CURLOPT_PROXY, libtest_arg2);
+ test_setopt(curl, CURLOPT_PROXYUSERPWD, libtest_arg3);
+ test_setopt(curl, CURLOPT_PROXYAUTH,
(long) (CURLAUTH_NTLM | CURLAUTH_DIGEST | CURLAUTH_BASIC) );
res = curl_easy_perform(curl);
+test_cleanup:
+
curl_easy_cleanup(curl);
curl_global_cleanup();