CURLOPT_REDIR_PROTOCOLS_STR.3 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. .\" generated by cd2nroff 0.1 from CURLOPT_REDIR_PROTOCOLS_STR.md
  2. .TH CURLOPT_REDIR_PROTOCOLS_STR 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_REDIR_PROTOCOLS_STR \- protocols allowed to redirect to
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REDIR_PROTOCOLS_STR,
  9. char *spec);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a pointer to a string that holds a comma\-separated list of case
  13. insensitive protocol names (URL schemes). That list limits what protocols
  14. libcurl may use in a transfer that it follows to in a redirect when
  15. \fICURLOPT_FOLLOWLOCATION(3)\fP is enabled. This option allows applications to
  16. limit specific transfers to only be allowed to use a subset of protocols in
  17. redirections.
  18. Protocols denied by \fICURLOPT_PROTOCOLS_STR(3)\fP are not overridden by this
  19. option.
  20. By default libcurl allows HTTP, HTTPS, FTP and FTPS on redirects (since
  21. 7.65.2).
  22. These are the available protocols:
  23. DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS,
  24. MQTT, POP3, POP3S, RTMP, RTMPE, RTMPS, RTMPT, RTMPTE, RTMPTS, RTSP, SCP, SFTP,
  25. SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS, WSS
  26. You can set "ALL" as a short\-cut to enable all protocols. Note that by setting
  27. all, you may enable protocols that were not supported the day you write this
  28. but are introduced in a future libcurl version.
  29. If trying to set a non\-existing protocol or if no matching protocol at all is
  30. set, it returns error.
  31. .SH DEFAULT
  32. HTTP, HTTPS, FTP and FTPS (Added in 7.65.2).
  33. Older versions defaulted to all protocols except FILE, SCP and since 7.40.0
  34. SMB and SMBS.
  35. .SH PROTOCOLS
  36. This functionality affects http only
  37. .SH EXAMPLE
  38. .nf
  39. int main(int argc, char **argv)
  40. {
  41. CURL *curl = curl_easy_init();
  42. if(curl) {
  43. /* pass in the URL from an external source */
  44. curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
  45. /* only allow redirects to HTTP and HTTPS URLs */
  46. curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS_STR, "http,https");
  47. /* Perform the request */
  48. curl_easy_perform(curl);
  49. }
  50. }
  51. .fi
  52. .SH AVAILABILITY
  53. Added in curl 7.85.0
  54. .SH RETURN VALUE
  55. Returns CURLE_UNKNOWN_OPTION if the option is not implemented,
  56. CURLE_UNSUPPORTED_PROTOCOL if a listed protocol is not supported or disabled,
  57. CURLE_BAD_FUNCTION_ARGUMENT if no protocol is listed else CURLE_OK.
  58. .SH SEE ALSO
  59. .BR CURLINFO_SCHEME (3),
  60. .BR CURLOPT_DEFAULT_PROTOCOL (3),
  61. .BR CURLOPT_PROTOCOLS (3),
  62. .BR CURLOPT_PROTOCOLS_STR (3),
  63. .BR CURLOPT_REDIR_PROTOCOLS (3)