diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2008-09-23 16:32:06 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2008-09-23 16:32:06 (GMT) |
commit | dd92d9ec38232dfc80b4fff804a0960d23ccc227 (patch) | |
tree | bfa3747b1e62ff8d2dd671200f6c88cf1784fb6b /Utilities/cmcurl-7.19.0/tests/libtest/lib519.c | |
parent | 5778b6efe98e3676e00f01cfeca62bd9b2b481b5 (diff) | |
download | CMake-dd92d9ec38232dfc80b4fff804a0960d23ccc227.zip CMake-dd92d9ec38232dfc80b4fff804a0960d23ccc227.tar.gz CMake-dd92d9ec38232dfc80b4fff804a0960d23ccc227.tar.bz2 |
ENH: import of new curl version
Diffstat (limited to 'Utilities/cmcurl-7.19.0/tests/libtest/lib519.c')
-rw-r--r-- | Utilities/cmcurl-7.19.0/tests/libtest/lib519.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Utilities/cmcurl-7.19.0/tests/libtest/lib519.c b/Utilities/cmcurl-7.19.0/tests/libtest/lib519.c new file mode 100644 index 0000000..ce44048 --- /dev/null +++ b/Utilities/cmcurl-7.19.0/tests/libtest/lib519.c @@ -0,0 +1,47 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * $Id$ + */ + +#include "test.h" + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + curl_easy_setopt(curl, CURLOPT_URL, URL); + curl_easy_setopt(curl, CURLOPT_USERPWD, "monster:underbed"); + curl_easy_setopt(curl, CURLOPT_HEADER, 1L); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* get first page */ + res = curl_easy_perform(curl); + + curl_easy_setopt(curl, CURLOPT_USERPWD, "anothermonster:inwardrobe"); + + /* get second page */ + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} + |