diff --git a/utils/remote.cc b/utils/remote.cc index 7b2aed6d6..5fdfc061e 100644 --- a/utils/remote.cc +++ b/utils/remote.cc @@ -84,6 +84,8 @@ struct Config std::string netrc; std::string session_id; std::string torrent_ids; + std::string unix_socket_path; + bool debug = false; bool use_ssl = false; }; @@ -232,7 +234,7 @@ enum **** ***/ -static auto constexpr Options = std::array{ +static auto constexpr Options = std::array{ { { 'a', "add", "Add torrent files by filename or URL", "a", false, nullptr }, { 970, "alt-speed", "Use the alternate Limits", "as", false, nullptr }, { 971, "no-alt-speed", "Don't use the alternate Limits", "AS", false, nullptr }, @@ -277,6 +279,7 @@ static auto constexpr Options = std::array{ { 'l', "list", "List all torrents", "l", false, nullptr }, { 'L', "labels", "Set the current torrents' labels", "L", true, "" }, { 960, "move", "Move current torrent's data to a new folder", nullptr, true, "" }, + { 968, "unix-socket", "Use a Unix domain socket", nullptr, true, "" }, { 961, "find", "Tell Transmission where to find a torrent's data", nullptr, true, "" }, { 964, "rename", "Rename torrents root folder or a file", nullptr, true, "" }, { 965, "path", "Provide path for rename functions", nullptr, true, "" }, @@ -411,6 +414,7 @@ static int getOptMode(int val) case 'a': /* add torrent */ case 'b': /* debug */ case 'n': /* auth */ + case 968: /* Unix domain socket */ case 810: /* authenv */ case 'N': /* netrc */ case 820: /* UseSSL */ @@ -2258,6 +2262,11 @@ static CURL* tr_curl_easy_init(struct evbuffer* writebuf, Config& config) CURLOPT_ENCODING, ""); /* "" tells curl to fill in the blanks with what it was compiled to support */ + if (auto const& str = config.unix_socket_path; !std::empty(str)) + { + (void)curl_easy_setopt(curl, CURLOPT_UNIX_SOCKET_PATH, str.c_str()); + } + if (auto const& str = config.netrc; !std::empty(str)) { (void)curl_easy_setopt(curl, CURLOPT_NETRC_FILE, str.c_str()); @@ -2444,6 +2453,10 @@ static int processArgs(char const* rpcurl, int argc, char const* const* argv, Co config.debug = true; break; + case 968: /* Unix domain socket */ + config.unix_socket_path = optarg; + break; + case 'n': /* auth */ config.auth = optarg; break; diff --git a/utils/transmission-remote.1 b/utils/transmission-remote.1 index f1c7edb02..ef4ee6bcb 100644 --- a/utils/transmission-remote.1 +++ b/utils/transmission-remote.1 @@ -255,6 +255,8 @@ Remove the current torrent(s) and delete their downloaded data. Reannounce the current torrent(s). This is the same as the GUI's "ask tracker for more peers" button. .It Fl -move Move the current torrents' data from their current locations to the specified directory. +.It Fl -unix-socket +Connect using a Unix domain socket. .It Fl -find Tell Transmission where to look for the current torrents' data. .It Fl sr Fl -seedratio Ar ratio