aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2013-04-04 16:20:27 +0200
committerYang Tse <yangsita@gmail.com>2013-04-04 16:31:27 +0200
commita6eade56ca0296ecca1a8476e1176e29f9fd0d3e (patch)
treeb49e643e29c913c0b4efd35cc665ddb3bedb5e64 /tests/libtest
parent5f5e4c92c469df24de131b33ebee9ad9a8fa919a (diff)
lib1509.c: fix compiler warnings
Diffstat (limited to 'tests/libtest')
-rw-r--r--tests/libtest/lib1509.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/tests/libtest/lib1509.c b/tests/libtest/lib1509.c
index 5087363d7..3c86a36b2 100644
--- a/tests/libtest/lib1509.c
+++ b/tests/libtest/lib1509.c
@@ -25,8 +25,6 @@
#include "warnless.h"
#include "memdebug.h"
-#define VERBOSE 0
-
size_t WriteOutput(void *ptr, size_t size, size_t nmemb, void *stream);
size_t WriteHeader(void *ptr, size_t size, size_t nmemb, void *stream);
@@ -34,12 +32,14 @@ long realHeaderSize = 0;
int test(char *URL)
{
- CURL *curl;
long headerSize;
- CURLcode res=CURLE_OK;
+ CURLcode code;
+ CURL *curl = NULL;
+ int res = 0;
+
+ global_init(CURL_GLOBAL_ALL);
- curl_global_init(CURL_GLOBAL_ALL);
- curl = curl_easy_init();
+ easy_init(curl);
easy_setopt(curl, CURLOPT_PROXY, libtest_arg2); /* set in first.c */
@@ -50,19 +50,34 @@ int test(char *URL)
easy_setopt(curl, CURLOPT_VERBOSE, 1L);
easy_setopt(curl, CURLOPT_URL, URL);
easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
- res = curl_easy_perform(curl);
- curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &headerSize);
+ code = curl_easy_perform(curl);
+ if(CURLE_OK != code) {
+ fprintf(stderr, "%s:%d curl_easy_perform() failed, "
+ "with code %d (%s)\n",
+ __FILE__, __LINE__, (int)code, curl_easy_strerror(code));
+ res = TEST_ERR_MAJOR_BAD;
+ goto test_cleanup;
+ }
+
+ code = curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &headerSize);
+ if(CURLE_OK != code) {
+ fprintf(stderr, "%s:%d curl_easy_getinfo() failed, "
+ "with code %d (%s)\n",
+ __FILE__, __LINE__, (int)code, curl_easy_strerror(code));
+ res = TEST_ERR_MAJOR_BAD;
+ goto test_cleanup;
+ }
+
printf("header length is ........: %lu\n", headerSize);
printf("header length should be..: %lu\n", realHeaderSize);
test_cleanup:
- /* undocumented cleanup sequence - type UA */
-
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+
+ return res;
}
size_t WriteOutput(void *ptr, size_t size, size_t nmemb, void *stream)