GNURLOPT_POSTQUOTE(3)

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

πŸ’… GNURLOPT_POSTQUOTE(3) πŸ’…

okay bestie, quick vibe check: this page lives in the curl_easy_setopt options manual, and it's all about CURLOPT_POSTQUOTE. buckle up, it's giving β€œpost-transfer FTP commands” energy πŸ¦‹βœ¨

🌸 NAME 🌸

CURLOPT_POSTQUOTE β€” (S)FTP commands to run after the transfer πŸ’–

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTQUOTE, struct
curl_slist *cmds);

πŸŽ€ DESCRIPTION πŸŽ€

So you pass a pointer to a linked list of FTP or SFTP commands, and those get passed to the server after your FTP transfer request. The commands will only be run if no error occurred β€” like, no error, no after-party πŸŽ‰. The linked list should be a fully valid list of struct curl_slist structs properly filled in as described for CURLOPT_QUOTE(3).

Want to turn it off again? Disable this operation by setting a NULL to this option. bye πŸ‘‹

πŸ“ DEFAULT πŸ“

NULL β€” iconically empty, and that's the default, periodt πŸ’…

🌈 PROTOCOLS 🌈

SFTP and FTP. that's the whole guest list 🫢

πŸ¦‹ EXAMPLE πŸ¦‹

Here's the example, copied with love and zero edits β€” code is sacred, fr fr 😌:

       struct curl_slist *cmdlist = NULL;
       cmdlist = curl_slist_append(cmdlist, "RNFR source-name");
       cmdlist = curl_slist_append(cmdlist, "RNTO new-name");

       curl = curl_easy_init();
       if(curl) {
         curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");

         /* pass in the FTP commands to run after the transfer */
         curl_easy_setopt(curl, CURLOPT_POSTQUOTE, cmdlist);

         ret = curl_easy_perform(curl);

         curl_easy_cleanup(curl);
       }

⭐ AVAILABILITY ⭐

If support for the protocols are built-in. yes, that's the condition, bestie πŸ’«

πŸ‘‘ RETURN VALUE πŸ‘‘

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. slay if supported, sad little CURLE_UNKNOWN_OPTION if not 😭

πŸ”₯ SEE ALSO πŸ”₯

✨ source/version check: libcurl 7.37.0, dated 17 Jun 2014 β€” mwah, and that's the GNURLOPT_POSTQUOTE(3) tea πŸ’‹βœ¨

πŸ“¦ where this page comes from