CURLOPT_REDIR_PROTOCOLS.3 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. .\" generated by cd2nroff 0.1 from CURLOPT_REDIR_PROTOCOLS.md
  2. .TH CURLOPT_REDIR_PROTOCOLS 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_REDIR_PROTOCOLS \- 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, long bitmask);
  9. .fi
  10. .SH DESCRIPTION
  11. This option is deprecated. We strongly recommend using
  12. \fICURLOPT_REDIR_PROTOCOLS_STR(3)\fP instead because this option cannot
  13. control all available protocols!
  14. Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask
  15. limits what protocols libcurl may use in a transfer that it follows to in a
  16. redirect when \fICURLOPT_FOLLOWLOCATION(3)\fP is enabled. This allows you to
  17. limit specific transfers to only be allowed to use a subset of protocols in
  18. redirections.
  19. Protocols denied by \fICURLOPT_PROTOCOLS(3)\fP are not overridden by this
  20. option.
  21. By default libcurl allows HTTP, HTTPS, FTP and FTPS on redirect (7.65.2).
  22. \fICURLPROTO_ALL\fP enables all protocols on redirect, including those
  23. otherwise disabled for security.
  24. These are the available protocol defines:
  25. .nf
  26. CURLPROTO_DICT
  27. CURLPROTO_FILE
  28. CURLPROTO_FTP
  29. CURLPROTO_FTPS
  30. CURLPROTO_GOPHER
  31. CURLPROTO_HTTP
  32. CURLPROTO_HTTPS
  33. CURLPROTO_IMAP
  34. CURLPROTO_IMAPS
  35. CURLPROTO_LDAP
  36. CURLPROTO_LDAPS
  37. CURLPROTO_POP3
  38. CURLPROTO_POP3S
  39. CURLPROTO_RTMP
  40. CURLPROTO_RTMPE
  41. CURLPROTO_RTMPS
  42. CURLPROTO_RTMPT
  43. CURLPROTO_RTMPTE
  44. CURLPROTO_RTMPTS
  45. CURLPROTO_RTSP
  46. CURLPROTO_SCP
  47. CURLPROTO_SFTP
  48. CURLPROTO_SMB
  49. CURLPROTO_SMBS
  50. CURLPROTO_SMTP
  51. CURLPROTO_SMTPS
  52. CURLPROTO_TELNET
  53. CURLPROTO_TFTP
  54. .fi
  55. .SH DEFAULT
  56. HTTP, HTTPS, FTP and FTPS (Added in 7.65.2).
  57. Older versions defaulted to all protocols except FILE, SCP and since 7.40.0
  58. SMB and SMBS.
  59. .SH PROTOCOLS
  60. This functionality affects http only
  61. .SH EXAMPLE
  62. .nf
  63. int main(int argc, char **argv)
  64. {
  65. CURL *curl = curl_easy_init();
  66. if(curl) {
  67. /* pass in the URL from an external source */
  68. curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
  69. /* only allow redirects to HTTP and HTTPS URLs */
  70. curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS,
  71. CURLPROTO_HTTP | CURLPROTO_HTTPS);
  72. /* Perform the request */
  73. curl_easy_perform(curl);
  74. }
  75. }
  76. .fi
  77. .SH DEPRECATED
  78. Deprecated since 7.85.0.
  79. .SH AVAILABILITY
  80. Added in curl 7.19.4
  81. .SH RETURN VALUE
  82. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  83. .SH SEE ALSO
  84. .BR CURLINFO_SCHEME (3),
  85. .BR CURLOPT_DEFAULT_PROTOCOL (3),
  86. .BR CURLOPT_PROTOCOLS (3),
  87. .BR CURLOPT_REDIR_PROTOCOLS_STR (3)