diff options
Diffstat (limited to 'tests/libtest/lib552.c')
-rw-r--r-- | tests/libtest/lib552.c | 62 |
1 files changed, 33 insertions, 29 deletions
diff --git a/tests/libtest/lib552.c b/tests/libtest/lib552.c index ce7ca1676..530c5df06 100644 --- a/tests/libtest/lib552.c +++ b/tests/libtest/lib552.c @@ -155,48 +155,52 @@ int test(char *URL) config.trace_ascii = 1; /* enable ascii tracing */ - curl = curl_easy_init(); - if(curl) { - curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace); - curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &config); - /* the DEBUGFUNCTION has no effect until we enable VERBOSE */ - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + if((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace); + test_setopt(curl, CURLOPT_DEBUGDATA, &config); + /* the DEBUGFUNCTION has no effect until we enable VERBOSE */ + test_setopt(curl, CURLOPT_VERBOSE, 1L); - /* setup repeated data string */ - for (i=0; i < sizeof(databuf); ++i) - databuf[i] = fill[i % sizeof fill]; + /* setup repeated data string */ + for (i=0; i < sizeof(databuf); ++i) + databuf[i] = fill[i % sizeof fill]; - /* Post */ - curl_easy_setopt(curl, CURLOPT_POST, 1L); + /* Post */ + test_setopt(curl, CURLOPT_POST, 1L); #ifdef CURL_DOES_CONVERSIONS - /* Convert the POST data to ASCII */ - curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); + /* Convert the POST data to ASCII */ + test_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); #endif - /* Setup read callback */ - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) sizeof(databuf)); - curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); + /* Setup read callback */ + test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) sizeof(databuf)); + test_setopt(curl, CURLOPT_READFUNCTION, read_callback); - /* Write callback */ - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback); + /* Write callback */ + test_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback); - /* Ioctl function */ - curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctl_callback); + /* Ioctl function */ + test_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctl_callback); - curl_easy_setopt(curl, CURLOPT_PROXY, libtest_arg2); + test_setopt(curl, CURLOPT_PROXY, libtest_arg2); - curl_easy_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_URL, URL); - /* Accept any auth. But for this bug configure proxy with DIGEST, basic might work too, not NTLM */ - curl_easy_setopt(curl, CURLOPT_PROXYAUTH, (long)CURLAUTH_ANY); + /* Accept any auth. But for this bug configure proxy with DIGEST, basic might work too, not NTLM */ + test_setopt(curl, CURLOPT_PROXYAUTH, (long)CURLAUTH_ANY); - res = curl_easy_perform(curl); - fprintf(stderr, "curl_easy_perform = %d\n", (int)res); + res = curl_easy_perform(curl); + fprintf(stderr, "curl_easy_perform = %d\n", (int)res); - /* always cleanup */ - curl_easy_cleanup(curl); - } +test_cleanup: + + curl_easy_cleanup(curl); curl_global_cleanup(); return (int)res; } |