Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "test.h"
00023
00024 #include "memdebug.h"
00025
00026 int test(char *URL)
00027 {
00028 CURLcode res;
00029 CURL *curl;
00030
00031 if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
00032 fprintf(stderr, "curl_global_init() failed\n");
00033 return TEST_ERR_MAJOR_BAD;
00034 }
00035
00036 curl = curl_easy_init();
00037 if(!curl) {
00038 fprintf(stderr, "curl_easy_init() failed\n");
00039 curl_global_cleanup();
00040 return TEST_ERR_MAJOR_BAD;
00041 }
00042
00043 test_setopt(curl, CURLOPT_URL, URL);
00044 test_setopt(curl, CURLOPT_USERPWD, "monster:underbed");
00045 test_setopt(curl, CURLOPT_HEADER, 1L);
00046 test_setopt(curl, CURLOPT_VERBOSE, 1L);
00047
00048
00049 res = curl_easy_perform(curl);
00050
00051 test_setopt(curl, CURLOPT_USERPWD, "anothermonster:inwardrobe");
00052
00053
00054 res = curl_easy_perform(curl);
00055
00056 test_cleanup:
00057
00058 curl_easy_cleanup(curl);
00059 curl_global_cleanup();
00060
00061 return (int)res;
00062 }
00063