CURLOPT_REDIR_PROTOCOLS.3 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_REDIR_PROTOCOLS 3 "January 02, 2023" "libcurl 7.88.1" "curl_easy_setopt options"
  26. .SH NAME
  27. CURLOPT_REDIR_PROTOCOLS \- protocols allowed to redirect to
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REDIR_PROTOCOLS, long bitmask);
  32. .fi
  33. .SH DESCRIPTION
  34. This option is deprecated. We strongly recommend using
  35. \fICURLOPT_REDIR_PROTOCOLS_STR(3)\fP instead because this option cannot
  36. control all available protocols!
  37. Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask
  38. limits what protocols libcurl may use in a transfer that it follows to in a
  39. redirect when \fICURLOPT_FOLLOWLOCATION(3)\fP is enabled. This allows you to
  40. limit specific transfers to only be allowed to use a subset of protocols in
  41. redirections.
  42. Protocols denied by \fICURLOPT_PROTOCOLS(3)\fP are not overridden by this
  43. option.
  44. By default libcurl will allow HTTP, HTTPS, FTP and FTPS on redirect (7.65.2).
  45. Older versions of libcurl allowed all protocols on redirect except several
  46. disabled for security reasons: Since 7.19.4 FILE and SCP are disabled, and
  47. since 7.40.0 SMB and SMBS are also disabled. \fICURLPROTO_ALL\fP enables all
  48. protocols on redirect, including those disabled for security.
  49. These are the available protocol defines:
  50. .nf
  51. CURLPROTO_DICT
  52. CURLPROTO_FILE
  53. CURLPROTO_FTP
  54. CURLPROTO_FTPS
  55. CURLPROTO_GOPHER
  56. CURLPROTO_HTTP
  57. CURLPROTO_HTTPS
  58. CURLPROTO_IMAP
  59. CURLPROTO_IMAPS
  60. CURLPROTO_LDAP
  61. CURLPROTO_LDAPS
  62. CURLPROTO_POP3
  63. CURLPROTO_POP3S
  64. CURLPROTO_RTMP
  65. CURLPROTO_RTMPE
  66. CURLPROTO_RTMPS
  67. CURLPROTO_RTMPT
  68. CURLPROTO_RTMPTE
  69. CURLPROTO_RTMPTS
  70. CURLPROTO_RTSP
  71. CURLPROTO_SCP
  72. CURLPROTO_SFTP
  73. CURLPROTO_SMB
  74. CURLPROTO_SMBS
  75. CURLPROTO_SMTP
  76. CURLPROTO_SMTPS
  77. CURLPROTO_TELNET
  78. CURLPROTO_TFTP
  79. .fi
  80. .SH DEFAULT
  81. HTTP, HTTPS, FTP and FTPS (Added in 7.65.2).
  82. Older versions defaulted to all protocols except FILE, SCP and since 7.40.0
  83. SMB and SMBS.
  84. .SH PROTOCOLS
  85. All
  86. .SH EXAMPLE
  87. .nf
  88. curl = curl_easy_init();
  89. if(curl) {
  90. /* pass in the URL from an external source */
  91. curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
  92. /* only allow redirects to HTTP and HTTPS URLs */
  93. curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS,
  94. CURLPROTO_HTTP | CURLPROTO_HTTPS);
  95. /* Perform the request */
  96. curl_easy_perform(curl);
  97. }
  98. .fi
  99. .SH AVAILABILITY
  100. Added in 7.19.4, before then it would follow all protocols. Deprecated
  101. since 7.85.0.
  102. .SH RETURN VALUE
  103. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  104. .SH "SEE ALSO"
  105. .BR CURLOPT_PROTOCOLS "(3), "