CURLOPT\_PROTOCOLS\_STR(3) Library Functions Manual CURLOPT\_PROTOCOLS\_STR(3)

# [NAME](#NAME)

CURLOPT\_PROTOCOLS\_STR - allowed protocols

# [SYNOPSIS](#SYNOPSIS)

```
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROTOCOLS_STR, char *spec);
```

# [DESCRIPTION](#DESCRIPTION)

Pass a pointer to a string that holds a comma-separated list of case insensitive protocol names (URL schemes) to allow in the transfer. This option allows applications to use libcurl built to support a wide range of protocols but still limit specific transfers to only be allowed to use a subset of them. By default, libcurl accepts all protocols it was built with support for. See also [*CURLOPT\_REDIR\_PROTOCOLS\_STR(3)*](/man/os/curl/CURLOPT_REDIR_PROTOCOLS_STR.3).

If trying to set a non-existing protocol or if no matching protocol at all is set, it returns error.

These are the available protocols:

DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, MQTTS, POP3, POP3S, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET, TFTP, WS, WSS

You can set "ALL" as a short-cut to enable all protocols. Note that by setting all, you may enable protocols that were not supported the day you write this but are introduced in a future libcurl version.

[*curl\_version\_info(3)*](/man/os/curl/curl_version_info.3) can be used to get a list of all supported protocols in the current libcurl. [*CURLINFO\_SCHEME(3)*](/man/os/curl/CURLINFO_SCHEME.3) is the recommended way to figure out the protocol used in a previous transfer.

Using this option multiple times makes the last set string override the previous ones. Set it to NULL to restore to the internal default.

# [DEFAULT](#DEFAULT)

All protocols built-in

# [PROTOCOLS](#PROTOCOLS)

This functionality affects all supported protocols

# [EXAMPLE](#EXAMPLE)

```
int main(int argc, char *argv[])
{


  CURL *curl = curl_easy_init();


  if(curl) {


    CURLcode result;


    /* pass in the URL from an external source */


    curl_easy_setopt(curl, CURLOPT_URL, argv[1]);


    /* only allow HTTP, TFTP and SFTP */


    curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, "http,tftp,sftp");


    /* Perform the request */


    result = curl_easy_perform(curl);


    curl_easy_cleanup(curl);


  }
}
```

# [HISTORY](#HISTORY)

RTMP and its related protocol schemes are not supported since curl 8.20.0

SMB and SMBS were removed in curl 8.23.0

# [AVAILABILITY](#AVAILABILITY)

Added in curl 7.85.0

# [RETURN VALUE](#RETURN_VALUE)

Returns CURLE\_UNKNOWN\_OPTION if the option is not implemented, CURLE\_UNSUPPORTED\_PROTOCOL if a listed protocol is not supported or disabled, CURLE\_BAD\_FUNCTION\_ARGUMENT if no protocol is listed else CURLE\_OK.

# [SEE ALSO](#SEE_ALSO)

[**CURLINFO\_SCHEME**(3)](/man/os/curl/CURLINFO_SCHEME.3), [**CURLOPT\_DEFAULT\_PROTOCOL**(3)](/man/os/curl/CURLOPT_DEFAULT_PROTOCOL.3), [**CURLOPT\_REDIR\_PROTOCOLS\_STR**(3)](/man/os/curl/CURLOPT_REDIR_PROTOCOLS_STR.3), [**CURLOPT\_URL**(3)](/man/os/curl/CURLOPT_URL.3), [**curl\_version\_info**(3)](/man/os/curl/curl_version_info.3)

2026-10-22 libcurl

---

Document: CURLOPT_PROTOCOLS_STR(3) from curl 8.23.0-r2 (Chainguard OS)
Source: https://github.com/curl/curl.git
