Skip to content

Commit

Permalink
ftpcom: FIX and libcurl deprecated CURLOPT_PROTOCOLS
Browse files Browse the repository at this point in the history
  • Loading branch information
ctlcltd committed Feb 25, 2023
1 parent 7f17d00 commit 9247a13
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 21 deletions.
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Utils scripts in **scripts** folder.

- For macOS with Xcode use scripts/darwin.sh

- For Windows with MinGW-64 use scripts/mingw32.sh
- For Windows with MinGW-64 use scripts/mingw.sh


### Required dependencies
Expand Down
2 changes: 1 addition & 1 deletion scripts/darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ relinking () {
local qtbase="/usr/local/opt/qt/lib"

if [[ -n "$1" ]]; then
local libs=$(xcrun dyldinfo -dylibs "$1" | tail -n +2)
local libs=$(dyld_info -dependents "$1" | tail -n +2)

for lib in $libs; do
if [[ "$lib" == "/usr/local/opt"* || "$lib" == "@rpath"* ]]; then
Expand Down
File renamed without changes.
20 changes: 2 additions & 18 deletions src/ftpcom/ftpcom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <filesystem>
#include <sstream>

// #define CURL_STATICLIB
#include "ftpcom.h"

using std::string, std::stringstream, std::min, std::endl, std::to_string;
Expand Down Expand Up @@ -85,12 +84,7 @@ bool ftpcom::handle()
curl_url_set(rph, CURLUPART_SCHEME, "ftp", 0);
curl_url_set(rph, CURLUPART_HOST, host.c_str(), 0);

#ifdef CURLOPT_PROTOCOLS_STR
curl_easy_setopt(csh, CURLOPT_PROTOCOLS_STR, "ftp");
#else
curl_easy_setopt(csh, CURLOPT_PROTOCOLS, CURLPROTO_FTP);
#endif

curl_easy_setopt(cph, CURLOPT_PROTOCOLS_STR, "ftp");
curl_easy_setopt(cph, CURLOPT_CURLU, rph);
curl_easy_setopt(cph, CURLOPT_USERNAME, user.c_str());
curl_easy_setopt(cph, CURLOPT_PASSWORD, pass.c_str());
Expand Down Expand Up @@ -470,12 +464,7 @@ bool ftpcom::cmd_ifreload()
// debug("cmd_ifreload", "URL", url);
// url = NULL;

#ifdef CURLOPT_PROTOCOLS_STR
curl_easy_setopt(csh, CURLOPT_PROTOCOLS_STR, "http");
#else
curl_easy_setopt(csh, CURLOPT_PROTOCOLS, CURLPROTO_HTTP);
#endif

curl_easy_setopt(csh, CURLOPT_HTTPGET, true);
curl_easy_setopt(csh, CURLOPT_FOLLOWLOCATION, true);
curl_easy_setopt(csh, CURLOPT_CURLU, rsh);
Expand Down Expand Up @@ -527,17 +516,12 @@ bool ftpcom::cmd_tnreload()
curl_url_set(rsh, CURLUPART_SCHEME, "telnet", 0);
curl_url_set(rsh, CURLUPART_HOST, host.c_str(), 0);

#ifdef CURLOPT_PROTOCOLS_STR
curl_easy_setopt(csh, CURLOPT_PROTOCOLS_STR, "telnet");
#else
curl_easy_setopt(csh, CURLOPT_PROTOCOLS, CURLPROTO_TELNET);
#endif

curl_easy_setopt(csh, CURLOPT_CURLU, rsh);
curl_easy_setopt(csh, CURLOPT_PORT, 23);
curl_easy_setopt(csh, CURLOPT_READFUNCTION, data_tn_shell_func);
curl_easy_setopt(csh, CURLOPT_READDATA, &data);
curl_easy_setopt(cph, CURLOPT_WRITEFUNCTION, data_discard_func);
curl_easy_setopt(csh, CURLOPT_WRITEFUNCTION, data_discard_func);
curl_easy_setopt(csh, CURLOPT_FAILONERROR, true);
// curl_easy_setopt(csh, CURLOPT_VERBOSE, true);

Expand Down
2 changes: 1 addition & 1 deletion src/ftpcom/ftpcom.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <unordered_map>
#include <cstdio>

#define CURL_STATICLIB
// #define CURL_STATICLIB
#include <curl/curl.h>

#include "../logger/logger.h"
Expand Down

0 comments on commit 9247a13

Please sign in to comment.