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 char *newURL = NULL;
00031 struct curl_slist *slist = NULL;
00032
00033 if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
00034 fprintf(stderr, "curl_global_init() failed\n");
00035 return TEST_ERR_MAJOR_BAD;
00036 }
00037
00038 curl = curl_easy_init();
00039 if(!curl) {
00040 fprintf(stderr, "curl_easy_init() failed\n");
00041 curl_global_cleanup();
00042 return TEST_ERR_MAJOR_BAD;
00043 }
00044
00045
00046
00047
00048 test_setopt(curl, CURLOPT_URL, URL);
00049 test_setopt(curl, CURLOPT_VERBOSE, 1L);
00050 test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
00051
00052 res = curl_easy_perform(curl);
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 newURL = aprintf("%s./", URL);
00063 if(newURL == NULL) {
00064 curl_easy_cleanup(curl);
00065 curl_global_cleanup();
00066 return TEST_ERR_MAJOR_BAD;
00067 }
00068
00069 slist = curl_slist_append(NULL, "SYST");
00070 if(slist == NULL) {
00071 free(newURL);
00072 curl_easy_cleanup(curl);
00073 curl_global_cleanup();
00074 return TEST_ERR_MAJOR_BAD;
00075 }
00076
00077 test_setopt(curl, CURLOPT_URL, newURL);
00078 test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
00079 test_setopt(curl, CURLOPT_QUOTE, slist);
00080
00081 res = curl_easy_perform(curl);
00082
00083 test_cleanup:
00084
00085 curl_slist_free_all(slist);
00086 free(newURL);
00087 curl_easy_cleanup(curl);
00088 curl_global_cleanup();
00089
00090 return (int)res;
00091 }