GNURLOPT_P...NSFER_MODE(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ’… GNURLOPT_P...NSFER_MODE(3) πŸ’…

okay so this is one of the curl_easy_setopt options, bestie β€” literally straight out of the gnurl/curl manual, and we're gonna get you fluent in it ✨


🌸 NAME 🌸

CURLOPT_PROXY_TRANSFER_MODE β€” it appends the FTP transfer mode to the URL when you're going through a proxy 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_TRANSFER_MODE,
long enabled);

✨ DESCRIPTION ✨

So you pass a long, right? And if that value is set to 1 (one), it tells libcurl to set the transfer mode β€” that's binary or ASCII β€” for FTP transfers done via an HTTP proxy, by appending ;type=a or ;type=i to the URL. no cap, that's the whole bit πŸ”₯

Without this setting β€” or if it's set to 0 (zero, which is the default btw) β€” CURLOPT_TRANSFERTEXT(3) has no effect when you're doing FTP via a proxy. Like, zero, nada, the setting just sits there looking cute 😭

⚠️ beware bestie: not all proxies support this feature. it's giving "your mileage may vary" and we do not want you blaming curl for that πŸ’€

πŸ’œ DEFAULT πŸ’œ

0, disabled β€” it's off until you say otherwise πŸ™ˆ


πŸ¦‹ PROTOCOLS πŸ¦‹

FTP over proxy 🌈


⭐ EXAMPLE ⭐

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/old-server/file.txt");
  curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:80");
  curl_easy_setopt(curl, CURLOPT_PROXY_TRANSFER_MODE, 1L);
  curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, 1L);
  ret = curl_easy_perform(curl);
  curl_easy_cleanup(curl);
}

look at her go πŸ‘‘ set the URL, set the proxy, flip the transfer mode on, flip transfertext on, and then actually perform it. order matters, iykyk πŸ’…


πŸ“ AVAILABILITY πŸ“

Added in 7.18.0 β€” vintage but iconic ✨


🧚 RETURN VALUE 🧚

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if the enabled value is not supported πŸ’–


🌈 SEE ALSO 🌈


k that's the whole page, mwah 🫢 β€” this one's from libcurl 7.37.0, dated 19 Jun 2014, and the page header lives at GNURLOPT_P...NSFER_MODE(3). go forth and proxy responsibly, bestie πŸ’œπŸŽ€

πŸ“¦ where this page comes from