mirror of
https://github.com/curl/curl.git
synced 2026-08-25 23:43:35 +03:00
ftp: ignore a 550 response to MDTM
The 550 is overused as a return code for multiple error case, e.g. file not found and/or insufficient permissions to access the file. So we cannot fail hard in this case. Adjust test 511 since we now fail later. Add new test 3027 which check that when MDTM failed, but the file could actually be retrieved, that in this case no filetime is provided. Reported-by: Michael Heimpold Fixes #9357 Closes #9387
This commit is contained in:
parent
f703cf971c
commit
d668685657
6 changed files with 124 additions and 5 deletions
|
|
@ -65,7 +65,7 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \
|
|||
lib1915 lib1916 lib1917 lib1918 lib1919 \
|
||||
lib1933 lib1934 lib1935 lib1936 lib1937 lib1938 lib1939 lib1940 \
|
||||
lib1945 lib1946 \
|
||||
lib3010 lib3025 lib3026
|
||||
lib3010 lib3025 lib3026 lib3027
|
||||
|
||||
chkdecimalpoint_SOURCES = chkdecimalpoint.c ../../lib/mprintf.c \
|
||||
../../lib/dynbuf.c ../../lib/strdup.c
|
||||
|
|
@ -759,3 +759,7 @@ lib3025_CPPFLAGS = $(AM_CPPFLAGS)
|
|||
lib3026_SOURCES = lib3026.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
|
||||
lib3026_LDADD = $(TESTUTIL_LIBS)
|
||||
lib3026_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
|
||||
lib3027_SOURCES = lib3027.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
|
||||
lib3027_LDADD = $(TESTUTIL_LIBS)
|
||||
lib3027_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
|
|
|
|||
56
tests/libtest/lib3027.c
Normal file
56
tests/libtest/lib3027.c
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 2020 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "test.h"
|
||||
|
||||
#include "testutil.h"
|
||||
#include "warnless.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
int test(char *URL)
|
||||
{
|
||||
CURLcode ret = CURLE_OK;
|
||||
CURL *hnd;
|
||||
start_test_timing();
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
hnd = curl_easy_init();
|
||||
if(hnd) {
|
||||
curl_easy_setopt(hnd, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(hnd, CURLOPT_FILETIME, 1L);
|
||||
ret = curl_easy_perform(hnd);
|
||||
if(CURLE_OK == ret) {
|
||||
long filetime;
|
||||
ret = curl_easy_getinfo(hnd, CURLINFO_FILETIME, &filetime);
|
||||
/* MTDM fails with 550, so filetime should be -1 */
|
||||
if((CURLE_OK == ret) && (filetime != -1)) {
|
||||
/* we just need to return something which is not CURLE_OK */
|
||||
ret = CURLE_UNSUPPORTED_PROTOCOL;
|
||||
}
|
||||
}
|
||||
curl_easy_cleanup(hnd);
|
||||
}
|
||||
curl_global_cleanup();
|
||||
return (int)ret;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue