GNURLOPT_REQUEST_TARGET(3)

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

πŸ’– NAME πŸ’–

Okay bestie, welcome to the GNURLOPT_REQUEST_TARGET(3) page from the curl_easy_setopt options manual. This is all about CURLOPT_REQUEST_TARGET β€” specify an alternative target for this request. That's the whole assignment, no cap. πŸ’…

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REQUEST_TARGET, string);

πŸ¦‹ DESCRIPTION πŸ¦‹

You pass a char * to string, and libcurl uses it in the upcoming request instead of the path as extracted from the URL. Literally that's it, and it's kind of iconic. ✨

πŸŽ€ DEFAULT πŸŽ€

The default is NULL. As in, nothing is set unless you set it. πŸ™ˆ

🌈 PROTOCOLS 🌈

HTTP. That's the vibe. 🌐

πŸ”₯ EXAMPLE πŸ”₯

curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/*");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "OPTIONS");

  /* issue an OPTIONS * request (no leading slash) */
  curl_easy_setopt(curl, CURLOPT_REQUEST_TARGET, "*");

  /* Perform the request */
  curl_easy_perform(curl);
}

⭐ AVAILABILITY ⭐

Added in 7.55.0. She's been around, okay? πŸ‘‘

😭 RETURN VALUE 😭

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. Fr fr, that's the whole return-value tea. 🫢

πŸ’… SEE ALSO πŸ’…

Go peek at CURLOPT_CUSTOMREQUEST(3), CURLOPT_HTTPGET(3), β€” iykyk. πŸ¦‹


mwah πŸ’‹ that's the page, bestie! libcurl 7.37.0 β€’ 17 Jun 2014 β€’ GNURLOPT_REQUEST_TARGET(3)

πŸ“¦ where this page comes from