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

[protolcols] Do not compile-in SFTP when ftp was disabled. Refs #304

This commit is contained in:
Witold Filipczyk 2024-05-27 10:23:46 +02:00
parent 21dcc580bc
commit 1f0ee66aec
4 changed files with 47 additions and 41 deletions

View File

@ -55,6 +55,8 @@
#include "util/memory.h"
#include "util/string.h"
#ifdef CONFIG_FTP
static char el_curlversion[256];
static void
@ -641,45 +643,6 @@ ftp_curl_handle_error(struct connection *conn, CURLcode res)
abort_connection(conn, connection_state(S_CURL_ERROR - res));
}
/* Check for completed transfers, and remove their easy handles */
void
check_multi_info(GlobalInfo *g)
{
//char *eff_url;
CURLMsg *msg;
int msgs_left;
struct connection *conn;
CURL *easy;
CURLcode res;
//fprintf(stderr, "REMAINING: %d\n", g->still_running);
while ((msg = curl_multi_info_read(g->multi, &msgs_left))) {
if (msg->msg == CURLMSG_DONE) {
easy = msg->easy_handle;
res = msg->data.result;
curl_easy_getinfo(easy, CURLINFO_PRIVATE, &conn);
if (conn->uri->protocol == PROTOCOL_HTTP || conn->uri->protocol == PROTOCOL_HTTPS) {
http_curl_handle_error(conn, res);
continue;
}
if (conn->uri->protocol == PROTOCOL_FTP || conn->uri->protocol == PROTOCOL_FTPES || conn->uri->protocol == PROTOCOL_SFTP) {
ftp_curl_handle_error(conn, res);
continue;
} else {
abort_connection(conn, connection_state(S_OK));
}
}
}
#if 0
if (g->still_running == 0 && g->stopped) {
event_base_loopbreak(g->evbase);
}
#endif
}
void
ftpes_protocol_handler(struct connection *conn)
{
@ -695,3 +658,4 @@ sftp_protocol_handler(struct connection *conn)
do_ftpes(conn);
}
}
#endif

View File

@ -505,3 +505,45 @@ http_curl_protocol_handler(struct connection *conn)
do_http(conn);
}
}
/* Check for completed transfers, and remove their easy handles */
void
check_multi_info(GlobalInfo *g)
{
//char *eff_url;
CURLMsg *msg;
int msgs_left;
struct connection *conn;
CURL *easy;
CURLcode res;
//fprintf(stderr, "REMAINING: %d\n", g->still_running);
while ((msg = curl_multi_info_read(g->multi, &msgs_left))) {
if (msg->msg == CURLMSG_DONE) {
easy = msg->easy_handle;
res = msg->data.result;
curl_easy_getinfo(easy, CURLINFO_PRIVATE, &conn);
if (conn->uri->protocol == PROTOCOL_HTTP || conn->uri->protocol == PROTOCOL_HTTPS) {
http_curl_handle_error(conn, res);
continue;
}
#ifdef CONFIG_FTP
if (conn->uri->protocol == PROTOCOL_FTP || conn->uri->protocol == PROTOCOL_FTPES || conn->uri->protocol == PROTOCOL_SFTP) {
ftp_curl_handle_error(conn, res);
continue;
}
#endif
else {
abort_connection(conn, connection_state(S_OK));
}
}
}
#if 0
if (g->still_running == 0 && g->stopped) {
event_base_loopbreak(g->evbase);
}
#endif
}

View File

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

View File

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