mirror of
https://github.com/curl/curl.git
synced 2026-07-30 05:08:07 +03:00
parent
daa5b044b8
commit
58e0ff809f
9 changed files with 171 additions and 172 deletions
|
|
@ -323,8 +323,8 @@ static CURLcode test_cli_hx_download(const char *URL)
|
|||
t = &transfer_d[i];
|
||||
t->easy = curl_easy_init();
|
||||
if(!t->easy ||
|
||||
setup_hx_download(t->easy, url, t, http_version, host, share,
|
||||
use_earlydata, fresh_connect)) {
|
||||
setup_hx_download(t->easy, url, t, http_version, host, share,
|
||||
use_earlydata, fresh_connect)) {
|
||||
curl_mfprintf(stderr, "[t-%d] FAILED setup\n", (int)i);
|
||||
result = (CURLcode)1;
|
||||
goto cleanup;
|
||||
|
|
|
|||
|
|
@ -44,39 +44,39 @@ static size_t t1507_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
|
|||
|
||||
static CURLcode test_lib1507(const char *URL)
|
||||
{
|
||||
static const int MULTI_PERFORM_HANG_TIMEOUT = 60 * 1000;
|
||||
static const int MULTI_PERFORM_HANG_TIMEOUT = 60 * 1000;
|
||||
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl = NULL;
|
||||
CURLM *mcurl = NULL;
|
||||
int still_running = 1;
|
||||
struct curltime mp_start;
|
||||
struct curl_slist *rcpt_list = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl = NULL;
|
||||
CURLM *mcurl = NULL;
|
||||
int still_running = 1;
|
||||
struct curltime mp_start;
|
||||
struct curl_slist *rcpt_list = NULL;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
easy_init(curl);
|
||||
easy_init(curl);
|
||||
|
||||
multi_init(mcurl);
|
||||
multi_init(mcurl);
|
||||
|
||||
rcpt_list = curl_slist_append(rcpt_list, RECIPIENT);
|
||||
/* more addresses can be added here
|
||||
rcpt_list = curl_slist_append(rcpt_list, "<others@example.com>");
|
||||
*/
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, URL);
|
||||
rcpt_list = curl_slist_append(rcpt_list, RECIPIENT);
|
||||
#if 0
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, USERNAME);
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, PASSWORD);
|
||||
/* more addresses can be added here */
|
||||
rcpt_list = curl_slist_append(rcpt_list, "<others@example.com>");
|
||||
#endif
|
||||
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, t1507_read_cb);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, MAILFROM);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list);
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
multi_add_handle(mcurl, curl);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, URL);
|
||||
#if 0
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, USERNAME);
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, PASSWORD);
|
||||
#endif
|
||||
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, t1507_read_cb);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, MAILFROM);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list);
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
multi_add_handle(mcurl, curl);
|
||||
|
||||
mp_start = curlx_now();
|
||||
mp_start = curlx_now();
|
||||
|
||||
/* we start some action by calling perform right away */
|
||||
curl_multi_perform(mcurl, &still_running);
|
||||
|
|
|
|||
|
|
@ -27,142 +27,142 @@
|
|||
|
||||
static CURLcode test_lib661(const char *URL)
|
||||
{
|
||||
CURLcode res;
|
||||
CURL *curl = NULL;
|
||||
char *newURL = NULL;
|
||||
struct curl_slist *slist = NULL;
|
||||
CURLcode res;
|
||||
CURL *curl = NULL;
|
||||
char *newURL = NULL;
|
||||
struct curl_slist *slist = NULL;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
/* test: CURLFTPMETHOD_SINGLECWD with absolute path should
|
||||
skip CWD to entry path */
|
||||
newURL = curl_maprintf("%s/folderA/661", URL);
|
||||
test_setopt(curl, CURLOPT_URL, newURL);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
|
||||
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
|
||||
goto test_cleanup;
|
||||
/* test: CURLFTPMETHOD_SINGLECWD with absolute path should
|
||||
skip CWD to entry path */
|
||||
newURL = curl_maprintf("%s/folderA/661", URL);
|
||||
test_setopt(curl, CURLOPT_URL, newURL);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
|
||||
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
|
||||
goto test_cleanup;
|
||||
|
||||
curl_free(newURL);
|
||||
newURL = curl_maprintf("%s/folderB/661", URL);
|
||||
test_setopt(curl, CURLOPT_URL, newURL);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
|
||||
goto test_cleanup;
|
||||
curl_free(newURL);
|
||||
newURL = curl_maprintf("%s/folderB/661", URL);
|
||||
test_setopt(curl, CURLOPT_URL, newURL);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
|
||||
goto test_cleanup;
|
||||
|
||||
/* test: CURLFTPMETHOD_NOCWD with absolute path should
|
||||
never emit CWD (for both new and reused easy handle) */
|
||||
curl_easy_cleanup(curl);
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
/* test: CURLFTPMETHOD_NOCWD with absolute path should
|
||||
never emit CWD (for both new and reused easy handle) */
|
||||
curl_easy_cleanup(curl);
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
curl_free(newURL);
|
||||
newURL = curl_maprintf("%s/folderA/661", URL);
|
||||
test_setopt(curl, CURLOPT_URL, newURL);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
|
||||
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
|
||||
goto test_cleanup;
|
||||
curl_free(newURL);
|
||||
newURL = curl_maprintf("%s/folderA/661", URL);
|
||||
test_setopt(curl, CURLOPT_URL, newURL);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
|
||||
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
|
||||
goto test_cleanup;
|
||||
|
||||
/* curve ball: CWD /folderB before reusing connection with _NOCWD */
|
||||
curl_free(newURL);
|
||||
newURL = curl_maprintf("%s/folderB/661", URL);
|
||||
test_setopt(curl, CURLOPT_URL, newURL);
|
||||
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
|
||||
goto test_cleanup;
|
||||
/* curve ball: CWD /folderB before reusing connection with _NOCWD */
|
||||
curl_free(newURL);
|
||||
newURL = curl_maprintf("%s/folderB/661", URL);
|
||||
test_setopt(curl, CURLOPT_URL, newURL);
|
||||
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
|
||||
goto test_cleanup;
|
||||
|
||||
curl_free(newURL);
|
||||
newURL = curl_maprintf("%s/folderA/661", URL);
|
||||
test_setopt(curl, CURLOPT_URL, newURL);
|
||||
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
|
||||
goto test_cleanup;
|
||||
curl_free(newURL);
|
||||
newURL = curl_maprintf("%s/folderA/661", URL);
|
||||
test_setopt(curl, CURLOPT_URL, newURL);
|
||||
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
|
||||
goto test_cleanup;
|
||||
|
||||
/* test: CURLFTPMETHOD_NOCWD with home-relative path should
|
||||
not emit CWD for first FTP access after login */
|
||||
curl_easy_cleanup(curl);
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
/* test: CURLFTPMETHOD_NOCWD with home-relative path should
|
||||
not emit CWD for first FTP access after login */
|
||||
curl_easy_cleanup(curl);
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
slist = curl_slist_append(NULL, "SYST");
|
||||
if(!slist) {
|
||||
curl_mfprintf(stderr, "curl_slist_append() failed\n");
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
slist = curl_slist_append(NULL, "SYST");
|
||||
if(!slist) {
|
||||
curl_mfprintf(stderr, "curl_slist_append() failed\n");
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_NOBODY, 1L);
|
||||
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
|
||||
test_setopt(curl, CURLOPT_QUOTE, slist);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_NOBODY, 1L);
|
||||
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
|
||||
test_setopt(curl, CURLOPT_QUOTE, slist);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
/* test: CURLFTPMETHOD_SINGLECWD with home-relative path should
|
||||
not emit CWD for first FTP access after login */
|
||||
curl_easy_cleanup(curl);
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
/* test: CURLFTPMETHOD_SINGLECWD with home-relative path should
|
||||
not emit CWD for first FTP access after login */
|
||||
curl_easy_cleanup(curl);
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_NOBODY, 1L);
|
||||
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
|
||||
test_setopt(curl, CURLOPT_QUOTE, slist);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_NOBODY, 1L);
|
||||
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
|
||||
test_setopt(curl, CURLOPT_QUOTE, slist);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
/* test: CURLFTPMETHOD_NOCWD with home-relative path should
|
||||
not emit CWD for second FTP access when not needed +
|
||||
bonus: see if path buffering survives curl_easy_reset() */
|
||||
curl_easy_reset(curl);
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_NOBODY, 1L);
|
||||
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
|
||||
test_setopt(curl, CURLOPT_QUOTE, slist);
|
||||
res = curl_easy_perform(curl);
|
||||
/* test: CURLFTPMETHOD_NOCWD with home-relative path should
|
||||
not emit CWD for second FTP access when not needed +
|
||||
bonus: see if path buffering survives curl_easy_reset() */
|
||||
curl_easy_reset(curl);
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_NOBODY, 1L);
|
||||
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
|
||||
test_setopt(curl, CURLOPT_QUOTE, slist);
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
if(res)
|
||||
curl_mfprintf(stderr, "test encountered error %d\n", res);
|
||||
curl_slist_free_all(slist);
|
||||
curl_free(newURL);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
if(res)
|
||||
curl_mfprintf(stderr, "test encountered error %d\n", res);
|
||||
curl_slist_free_all(slist);
|
||||
curl_free(newURL);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue