CURLOPT_PROTOCOLS_STR.3 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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_PROTOCOLS_STR 3 "January 02, 2023" "libcurl 7.88.1" "curl_easy_setopt options"
  26. .SH NAME
  27. CURLOPT_PROTOCOLS_STR \- allowed protocols
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROTOCOLS_STR, char *spec);
  32. .fi
  33. .SH DESCRIPTION
  34. Pass a pointer to a string that holds a comma-separated list of case
  35. insensitive protocol names (URL schemes) to allow in the transfer. This
  36. option allows applications to use libcurl built to support a wide range of
  37. protocols but still limit specific transfers to only be allowed to use a
  38. subset of them. By default, libcurl accepts all protocols it was built with
  39. support for. See also \fICURLOPT_REDIR_PROTOCOLS_STR(3)\fP.
  40. If trying to set a non-existing protocol or if no matching protocol at all is
  41. set, it returns error.
  42. These are the available protocols:
  43. DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS,
  44. MQTT, POP3, POP3S, RTMP, RTMPE, RTMPS, RTMPT, RTMPTE, RTMPTS, RTSP, SCP, SFTP,
  45. SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS, WSS
  46. You can set "ALL" as a short-cut to enable all protocols. Note that by setting
  47. all, you may enable protocols that were not supported the day you write this
  48. but are introduced in a future libcurl version.
  49. \fIcurl_version_info(3)\fP can be used to get a list of all supported
  50. protocols in the current libcurl. \fICURLINFO_SCHEME(3)\fP is the recommended
  51. way to figure out the protocol used in a previous transfer.
  52. .SH DEFAULT
  53. All protocols built-in
  54. .SH PROTOCOLS
  55. All
  56. .SH EXAMPLE
  57. .nf
  58. curl = curl_easy_init();
  59. if(curl) {
  60. /* pass in the URL from an external source */
  61. curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
  62. /* only allow HTTP, TFTP and SFTP */
  63. curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, "http,tftp,sftp");
  64. /* Perform the request */
  65. curl_easy_perform(curl);
  66. }
  67. .fi
  68. .SH AVAILABILITY
  69. Added in 7.85.0
  70. .SH RETURN VALUE
  71. Returns CURLE_UNKNOWN_OPTION if the option is not implemented,
  72. CURLE_UNSUPPORTED_PROTOCOL if a listed protocol is not supported or disabled,
  73. CURLE_BAD_FUNCTION_ARGUMENT if no protocol is listed else CURLE_OK.
  74. .SH "SEE ALSO"
  75. .BR CURLOPT_REDIR_PROTOCOLS_STR "(3), " CURLOPT_URL "(3), "
  76. .BR curl_version_info "(3), " CURLINFO_SCHEME "(3), "