netutils/ftpc: add config for using binary type for size command
This is handy for FOTA clients and others that always get binary files. Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
This commit is contained in:
parent
8f0e872384
commit
4a56546811
@ -26,6 +26,12 @@ config FTP_TMPDIR
|
|||||||
The path to use for storing temporary files used in the transfer process
|
The path to use for storing temporary files used in the transfer process
|
||||||
by the FTP client.
|
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
|
config FTPC_DISABLE_EPRT
|
||||||
bool "Disable EPRT and use PORT instead"
|
bool "Disable EPRT and use PORT instead"
|
||||||
default n
|
default n
|
||||||
|
@ -46,26 +46,6 @@
|
|||||||
|
|
||||||
#include "ftpc_internal.h"
|
#include "ftpc_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Types
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public 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;
|
FAR struct ftpc_session_s *session = (FAR struct ftpc_session_s *)handle;
|
||||||
unsigned long ret;
|
unsigned long ret;
|
||||||
|
uint8_t mode = FTPC_XFRMODE_ASCII;
|
||||||
|
|
||||||
/* Check if the host supports the SIZE command */
|
/* Check if the host supports the SIZE command */
|
||||||
|
|
||||||
@ -90,7 +71,11 @@ off_t ftpc_filesize(SESSION handle, FAR const char *path)
|
|||||||
return ERROR;
|
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;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user