From 27af8266a4bea76933df1f61baa9f36763cc39f5 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 19 Nov 2024 12:09:00 +0100 Subject: [PATCH] [curl] Allow to set outgoing interface Command line option "bind-address" is reused for it. --- src/protocol/curl/ftp.c | 4 ++++ src/protocol/curl/http.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/protocol/curl/ftp.c b/src/protocol/curl/ftp.c index c1331b86b..fa9a8a5fd 100644 --- a/src/protocol/curl/ftp.c +++ b/src/protocol/curl/ftp.c @@ -513,6 +513,10 @@ do_ftpes(struct connection *conn) curl_easy_setopt(curl, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t)get_opt_long("protocol.ftp.curl_max_recv_speed", NULL)); curl_easy_setopt(curl, CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t)get_opt_long("protocol.ftp.curl_max_send_speed", NULL)); + char *interface = get_cmd_opt_str("bind-address"); + if (interface && *interface) { + curl_easy_setopt(curl, CURLOPT_INTERFACE, interface); + } //curl_easy_setopt(curl, CURLOPT_XFERINFODATA, conn); //curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, progress_callback); diff --git a/src/protocol/curl/http.c b/src/protocol/curl/http.c index 84a1c840d..07d3decd9 100644 --- a/src/protocol/curl/http.c +++ b/src/protocol/curl/http.c @@ -207,6 +207,11 @@ do_http(struct connection *conn) curl_easy_setopt(curl, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t)get_opt_long("protocol.http.curl_max_recv_speed", NULL)); curl_easy_setopt(curl, CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t)get_opt_long("protocol.http.curl_max_send_speed", NULL)); + char *interface = get_cmd_opt_str("bind-address"); + if (interface && *interface) { + curl_easy_setopt(curl, CURLOPT_INTERFACE, interface); + } + if (conn->uri->protocol == PROTOCOL_HTTPS) { char *ciphers = get_opt_str("protocol.https.curl_tls13_ciphers", NULL);