diff --git a/netutils/ftpc/Kconfig b/netutils/ftpc/Kconfig index ff3f031cb..9df86947f 100644 --- a/netutils/ftpc/Kconfig +++ b/netutils/ftpc/Kconfig @@ -26,6 +26,12 @@ config FTP_TMPDIR The path to use for storing temporary files used in the transfer process by the FTP client. +config FTP_SIZE_CMD_MODE_BINARY + bool "Use binary mode for size command" + default n + ---help--- + Use binary transfer mode for FTP size command. + config FTPC_DISABLE_EPRT bool "Disable EPRT and use PORT instead" default n diff --git a/netutils/ftpc/ftpc_filesize.c b/netutils/ftpc/ftpc_filesize.c index 4e886f5fa..efd3419d5 100644 --- a/netutils/ftpc/ftpc_filesize.c +++ b/netutils/ftpc/ftpc_filesize.c @@ -46,26 +46,6 @@ #include "ftpc_internal.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -82,6 +62,7 @@ off_t ftpc_filesize(SESSION handle, FAR const char *path) { FAR struct ftpc_session_s *session = (FAR struct ftpc_session_s *)handle; unsigned long ret; + uint8_t mode = FTPC_XFRMODE_ASCII; /* Check if the host supports the SIZE command */ @@ -90,7 +71,11 @@ off_t ftpc_filesize(SESSION handle, FAR const char *path) return ERROR; } - if (ftpc_xfrmode(session, FTPC_XFRMODE_ASCII) != 0) +#ifdef CONFIG_FTP_SIZE_CMD_MODE_BINARY + mode = FTPC_XFRMODE_BINARY; +#endif + + if (ftpc_xfrmode(session, mode) != 0) { return ERROR; }