CURLOPT_REQUEST_TARGET.3 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. .\" generated by cd2nroff 0.1 from CURLOPT_REQUEST_TARGET.md
  2. .TH CURLOPT_REQUEST_TARGET 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_REQUEST_TARGET \- alternative target for this request
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REQUEST_TARGET, string);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a char pointer to string which libcurl uses in the upcoming request
  12. instead of the path as extracted from the URL.
  13. libcurl passes on the verbatim string in its request without any filter or
  14. other safe guards. That includes white space and control characters.
  15. .SH DEFAULT
  16. NULL
  17. .SH PROTOCOLS
  18. This functionality affects http only
  19. .SH EXAMPLE
  20. .nf
  21. int main(void)
  22. {
  23. CURL *curl = curl_easy_init();
  24. if(curl) {
  25. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/*");
  26. curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "OPTIONS");
  27. /* issue an OPTIONS * request (no leading slash) */
  28. curl_easy_setopt(curl, CURLOPT_REQUEST_TARGET, "*");
  29. /* Perform the request */
  30. curl_easy_perform(curl);
  31. }
  32. }
  33. .fi
  34. .SH AVAILABILITY
  35. Added in curl 7.55.0
  36. .SH RETURN VALUE
  37. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  38. .SH SEE ALSO
  39. .BR CURLOPT_CUSTOMREQUEST (3),
  40. .BR CURLOPT_HTTPGET (3),
  41. .BR CURLOPT_PATH_AS_IS (3),
  42. .BR CURLOPT_URL (3)