test661: return from test early in case of curl error

This commit is contained in:
Dan Fandrich 2023-09-11 14:27:52 -07:00
parent 381792dfbf
commit f0e4fa445d

View File

@ -51,11 +51,15 @@ int test(char *URL)
test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
curl_free(newURL);
newURL = aprintf("%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) */
@ -74,6 +78,8 @@ int test(char *URL)
test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) 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);
@ -81,12 +87,16 @@ int test(char *URL)
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
curl_free(newURL);
newURL = aprintf("%s/folderA/661", URL);
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) 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 */
@ -111,6 +121,8 @@ int test(char *URL)
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) 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 */
@ -128,6 +140,8 @@ int test(char *URL)
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) 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 +
@ -143,6 +157,8 @@ int test(char *URL)
test_cleanup:
if(res)
fprintf(stderr, "test encountered error %d\n", res);
curl_slist_free_all(slist);
curl_free(newURL);
curl_easy_cleanup(curl);