From e69168c58a425be9d34c24f2458058466b4bd596 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Thu, 22 Jun 2023 19:39:13 +0200 Subject: [PATCH] [ftp] Added bool option "protocol.ftp.use_curl" --- src/protocol/ftp/ftp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/protocol/ftp/ftp.c b/src/protocol/ftp/ftp.c index 32aba307..04fee91f 100644 --- a/src/protocol/ftp/ftp.c +++ b/src/protocol/ftp/ftp.c @@ -43,6 +43,7 @@ #include "osdep/stat.h" #include "protocol/auth/auth.h" #include "protocol/common.h" +#include "protocol/curl/ftpes.h" #include "protocol/ftp/ftp.h" #include "protocol/ftp/parse.h" #include "protocol/uri.h" @@ -71,6 +72,12 @@ union option_info ftp_options[] = { "anon_passwd", OPT_ZERO, "some@host.domain", N_("FTP anonymous password to be sent.")), +#if defined(CONFIG_LIBCURL) && defined(CONFIG_LIBEVENT) + INIT_OPT_BOOL("protocol.ftp", N_("Use libcurl"), + "use_curl", OPT_ZERO, 0, + N_("Use libcurl implementation of ftp.")), +#endif + INIT_OPT_BOOL("protocol.ftp", N_("Use passive mode (IPv4)"), "use_pasv", OPT_ZERO, 1, N_("Use PASV instead of PORT (passive vs active mode, " @@ -282,6 +289,12 @@ ok: void ftp_protocol_handler(struct connection *conn) { +#if defined(CONFIG_LIBCURL) && defined(CONFIG_LIBEVENT) + if (get_opt_bool("protocol.ftp.use_curl", NULL)) { + ftpes_protocol_handler(conn); + return; + } +#endif if (!has_keepalive_connection(conn)) { make_connection(conn->socket, conn->uri, ftp_login, conn->cache_mode >= CACHE_MODE_FORCE_RELOAD);