1 /*****************************************************************************
3 * Project ___| | | | _ \| |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
19 struct curl_slist *slist = NULL;
21 if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
22 fprintf(stderr, "curl_global_init() failed\n");
23 return TEST_ERR_MAJOR_BAD;
26 if ((curl = curl_easy_init()) == NULL) {
27 fprintf(stderr, "curl_easy_init() failed\n");
28 curl_global_cleanup();
29 return TEST_ERR_MAJOR_BAD;
33 * Begin with cURL set to use a single CWD to the URL's directory.
35 test_setopt(curl, CURLOPT_URL, URL);
36 test_setopt(curl, CURLOPT_VERBOSE, 1L);
37 test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
39 res = curl_easy_perform(curl);
42 * Change the FTP_FILEMETHOD option to use full paths rather than a CWD
43 * command. Alter the URL's path a bit, appending a "./". Use an innocuous
44 * QUOTE command, after which cURL will CWD to ftp_conn->entrypath and then
45 * (on the next call to ftp_statemach_act) find a non-zero ftpconn->dirdepth
46 * even though no directories are stored in the ftpconn->dirs array (after a
49 newURL = malloc(strlen(URL) + 3);
51 curl_easy_cleanup(curl);
52 curl_global_cleanup();
53 return TEST_ERR_MAJOR_BAD;
55 newURL = strcat(strcpy(newURL, URL), "./");
57 slist = curl_slist_append (NULL, "SYST");
60 curl_easy_cleanup(curl);
61 curl_global_cleanup();
62 return TEST_ERR_MAJOR_BAD;
65 test_setopt(curl, CURLOPT_URL, newURL);
66 test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
67 test_setopt(curl, CURLOPT_QUOTE, slist);
69 res = curl_easy_perform(curl);
73 curl_slist_free_all(slist);
76 curl_easy_cleanup(curl);
77 curl_global_cleanup();