CURLOPT_REDIR_PROTOCOLS_STR.3 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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_STR 3 "19 Jun 2014" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_REDIR_PROTOCOLS_STR \- 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_STR,
  32. char *spec);
  33. .fi
  34. .SH DESCRIPTION
  35. Pass a pointer to a string that holds a comma-separated list of case
  36. insensitive protocol names (URL schemes). That list limits what protocols
  37. libcurl may use in a transfer that it follows to in a redirect when
  38. \fICURLOPT_FOLLOWLOCATION(3)\fP is enabled. This option allows applications to
  39. limit specific transfers to only be allowed to use a subset of protocols in
  40. redirections.
  41. Protocols denied by \fICURLOPT_PROTOCOLS_STR(3)\fP are not overridden by this
  42. option.
  43. By default libcurl will allow HTTP, HTTPS, FTP and FTPS on redirects (since
  44. 7.65.2). Older versions of libcurl allowed all protocols on redirect except
  45. several disabled for security reasons: Since 7.19.4 FILE and SCP are disabled,
  46. and since 7.40.0 SMB and SMBS are also disabled.
  47. These are the available protocols:
  48. DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS,
  49. MQTT, POP3, POP3S, RTMP, RTMPE, RTMPS, RTMPT, RTMPTE, RTMPTS, RTSP, SCP, SFTP,
  50. SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS, WSS
  51. You can set "ALL" as a short-cut to enable all protocols. Note that by setting
  52. all, you may enable protocols that were not supported the day you write this
  53. but are introduced in a future libcurl version.
  54. If trying to set a non-existing protocol or if no matching protocol at all is
  55. set, it returns error.
  56. .SH DEFAULT
  57. HTTP, HTTPS, FTP and FTPS (Added in 7.65.2).
  58. Older versions defaulted to all protocols except FILE, SCP and since 7.40.0
  59. SMB and SMBS.
  60. .SH PROTOCOLS
  61. All
  62. .SH EXAMPLE
  63. .nf
  64. curl = curl_easy_init();
  65. if(curl) {
  66. /* pass in the URL from an external source */
  67. curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
  68. /* only allow redirects to HTTP and HTTPS URLs */
  69. curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS_STR, "http,https");
  70. /* Perform the request */
  71. curl_easy_perform(curl);
  72. }
  73. .fi
  74. .SH AVAILABILITY
  75. Added in 7.85.0.
  76. .SH RETURN VALUE
  77. Returns CURLE_UNKNOWN_OPTION if the option is not implemented,
  78. CURLE_UNSUPPORTED_PROTOCOL if a listed protocol is not supported or disabled,
  79. CURLE_BAD_FUNCTION_ARGUMENT if no protocol is listed else CURLE_OK.
  80. .SH "SEE ALSO"
  81. .BR CURLOPT_PROTOCOLS_STR "(3), "