1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[SFTP] Added -Dsftp option. Enabled by default

Fixed building tests.
SFTP can be disabled, even if FTP and libcurl are enabled.
This commit is contained in:
Witold Filipczyk 2024-05-27 16:31:25 +02:00
parent eb2aaf25ec
commit 17e905b95d
19 changed files with 49 additions and 17 deletions

View File

@ -180,6 +180,7 @@ CONFIG_SCRIPTING_PERL = @CONFIG_SCRIPTING_PERL@
CONFIG_SCRIPTING_PYTHON = @CONFIG_SCRIPTING_PYTHON@
CONFIG_SCRIPTING_RUBY = @CONFIG_SCRIPTING_RUBY@
CONFIG_SCRIPTING_SPIDERMONKEY = @CONFIG_SCRIPTING_SPIDERMONKEY@
CONFIG_SFTP = @CONFIG_SFTP@
CONFIG_SMALL = @CONFIG_SMALL@
CONFIG_SMB = @CONFIG_SMB@
CONFIG_SPIDERMONKEY = @CONFIG_SPIDERMONKEY@

View File

@ -247,6 +247,9 @@
/* Define if you want: SpiderMonkey support */
#mesondefine CONFIG_SCRIPTING_SPIDERMONKEY
/* Define if you want: SFTP protocol support. Requires libcurl */
#mesondefine CONFIG_SFTP
/* Define if you want: Small binary support */
#mesondefine CONFIG_SMALL

View File

@ -1691,6 +1691,9 @@ fi
EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
[ --disable-ftp disable ftp protocol support])
EL_ARG_ENABLE(CONFIG_SFTP, sftp, [SFTP protocol],
[ --disable-sftp disable sftp protocol support])
EL_ARG_ENABLE(CONFIG_GEMINI, gemini, [Gemini protocol],
[ --enable-gemini enable gemini protocol support])

View File

@ -375,6 +375,13 @@ CONFIG_FSP=no
CONFIG_FTP=yes
# SFTP
# See https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol .
# Requires libcurl.
#
# Default: enabled
CONFIG_SFTP=yes
### Gopher Protocol Support
#

View File

@ -43,6 +43,7 @@ conf_data.set('CONFIG_FINGER', get_option('finger'))
conf_data.set('CONFIG_FSP', get_option('fsp'))
conf_data.set('CONFIG_FSP2', get_option('fsp2'))
conf_data.set('CONFIG_FTP', get_option('ftp'))
conf_data.set('CONFIG_SFTP', get_option('sftp'))
conf_data.set('CONFIG_GOPHER', get_option('gopher'))
conf_data.set('CONFIG_NNTP', get_option('nntp'))
conf_data.set('CONFIG_SMB', get_option('smb'))

View File

@ -82,5 +82,6 @@ option('pdfdoc', type: 'boolean', value: true, description: 'whether to build ma
option('libcss', type: 'boolean', value: true, description: 'whether to compile libcss support, requires libdom. This option is automatically enabled with js support')
option('libsixel', type: 'boolean', value: false, description: 'whether to compile libsixel support to show images directly on sixel compatible terminals')
option('libcurl', type: 'boolean', value: true, description: 'whether to compile libcurl support. This option is automatically enabled with js support')
option('sftp', type: 'boolean', value: true, description: 'whether to compile SFTP protocol support. Requires libcurl')
option('msys2', type: 'boolean', value: false, description: 'whether to build for msys2')

View File

@ -16,6 +16,9 @@ SUBDIRS = auth file http test
OBJS-$(CONFIG_DATA) += data.o
OBJS-$(CONFIG_FTP) += ftpparse.o
OBJS-$(CONFIG_SFTP) += ftpparse.o
OBJS = about.o common.o date.o header.o protocol.o proxy.o uri.o user.o
include $(top_srcdir)/Makefile.lib

View File

@ -48,15 +48,16 @@
#include "protocol/curl/ftpes.h"
#include "protocol/curl/http.h"
#include "protocol/curl/sftp.h"
#include "protocol/ftp/parse.h"
#include "protocol/ftpparse.h"
#include "protocol/uri.h"
#include "util/conv.h"
#include "util/error.h"
#include "util/memory.h"
#include "util/string.h"
#ifdef CONFIG_FTP
#if defined(CONFIG_FTP) || defined(CONFIG_SFTP)
#ifdef CONFIG_FTP
static char el_curlversion[256];
static void
@ -75,7 +76,9 @@ struct module ftpes_protocol_module = struct_module(
/* init: */ init_ftpes,
/* done: */ NULL
);
#endif
#ifdef CONFIG_SFTP
struct module sftp_protocol_module = struct_module(
/* name: */ N_("SFTP"),
/* options: */ NULL,
@ -85,7 +88,7 @@ struct module sftp_protocol_module = struct_module(
/* init: */ NULL,
/* done: */ NULL
);
#endif
#define FTP_BUF_SIZE 16384
@ -643,6 +646,7 @@ ftp_curl_handle_error(struct connection *conn, CURLcode res)
abort_connection(conn, connection_state(S_CURL_ERROR - res));
}
#ifdef CONFIG_FTP
void
ftpes_protocol_handler(struct connection *conn)
{
@ -650,7 +654,9 @@ ftpes_protocol_handler(struct connection *conn)
do_ftpes(conn);
}
}
#endif
#ifdef CONFIG_SFTP
void
sftp_protocol_handler(struct connection *conn)
{
@ -659,3 +665,5 @@ sftp_protocol_handler(struct connection *conn)
}
}
#endif
#endif

View File

@ -10,7 +10,7 @@ extern "C" {
extern struct module sftp_protocol_module;
#if defined(CONFIG_FTP) && defined(CONFIG_LIBCURL)
#if defined(CONFIG_SFTP) && defined(CONFIG_LIBCURL)
extern protocol_handler_T sftp_protocol_handler;
#else
#define sftp_protocol_handler NULL

View File

@ -1,13 +1,13 @@
top_builddir=../../..
include $(top_builddir)/Makefile.config
OBJS = ftp.o parse.o
OBJS = ftp.o
TEST_PROGS = \
ftp-parser$(EXEEXT)
TESTDEPS = \
$(top_builddir)/src/protocol/date.o \
$(top_builddir)/src/protocol/ftp/parse.o
$(top_builddir)/src/protocol/ftpparse.o
include $(top_srcdir)/Makefile.lib

View File

@ -12,7 +12,7 @@
#include "elinks.h"
#include "osdep/stat.h"
#include "protocol/ftp/parse.h"
#include "protocol/ftpparse.h"
#include "util/test.h"
/* fake tty get function, needed for charsets.c */

View File

@ -49,7 +49,7 @@
#include "protocol/common.h"
#include "protocol/curl/ftpes.h"
#include "protocol/ftp/ftp.h"
#include "protocol/ftp/parse.h"
#include "protocol/ftpparse.h"
#include "protocol/uri.h"
#include "util/conv.h"
#include "util/error.h"

View File

@ -1,7 +1,7 @@
srcs += files('ftp.c', 'parse.c')
srcs += files('ftp.c')
if get_option('test')
exe = executable('ftp-parser', 'ftp-parser.c', 'parse.c', meson.source_root()+'/src/protocol/date.c', testdeps, dependencies:[iconvdeps],
exe = executable('ftp-parser', 'ftp-parser.c', meson.source_root()+'/src/protocol/date.c', meson.source_root()+'/src/protocol/ftpparse.c', testdeps, dependencies:[iconvdeps],
c_args:['-DHAVE_CONFIG_H'], cpp_args:['-DHAVE_CONFIG_H'], include_directories:['.','../..','../../..'],
build_by_default:false)

View File

@ -23,7 +23,7 @@
#include "osdep/ascii.h"
#include "osdep/stat.h"
#include "protocol/date.h"
#include "protocol/ftp/parse.h"
#include "protocol/ftpparse.h"
#include "util/conv.h"
#include "util/string.h"
#include "util/time.h"

View File

@ -1,7 +1,7 @@
/* FTP directory parsing */
#ifndef EL__PROTOCOL_FTP_PARSE_H
#define EL__PROTOCOL_FTP_PARSE_H
#ifndef EL__PROTOCOL_FTPPARSE_H
#define EL__PROTOCOL_FTPPARSE_H
#include "util/string.h"

View File

@ -35,6 +35,11 @@ subdir('http')
if conf_data.get('CONFIG_DATA')
srcs += files('data.c')
endif
if conf_data.get('CONFIG_FTP') or conf_data.get('CONFIG_SFTP')
srcs += files('ftpparse.c')
endif
srcs += files('about.c', 'common.c', 'date.c', 'header.c', 'protocol.c', 'proxy.c', 'uri.c', 'user.c')
if get_option('test')

View File

@ -336,7 +336,7 @@ static struct module *protocol_submodules[] = {
#ifdef CONFIG_NNTP
&nntp_protocol_module,
#endif
#if defined(CONFIG_FTP) && defined(CONFIG_LIBCURL)
#if defined(CONFIG_SFTP) && defined(CONFIG_LIBCURL)
&sftp_protocol_module,
#endif
#ifdef CONFIG_SMB

View File

@ -5,7 +5,7 @@ TEST_PROGS = \
uri-test$(EXEEXT)
TESTDEPS = \
$(top_builddir)/src/protocol/protocol.obj \
$(top_builddir)/src/protocol/protocol.o \
$(top_builddir)/src/protocol/uri.o \
stub.o

View File

@ -1,6 +1,6 @@
idna_dep = dependency('libidn2')
uri_test_files = files('uri-test.c', 'stub.c', meson.current_source_dir()+'/../protocol.cpp', meson.current_source_dir()+'/../uri.c')
uri_test_files = files('uri-test.c', 'stub.c', meson.current_source_dir()+'/../protocol.c', meson.current_source_dir()+'/../uri.c')
exe = executable('uri-test', uri_test_files,
testdeps, dependencies: [iconvdeps, idna_dep, mozjsdeps, wattdeps],