CURLOPT\_DISALLOW\_USERNAME\_IN\_URL(3) Library Functions Manual CURLOPT\_DISALLOW\_USERNAME\_IN\_URL(3)

# [NAME](#NAME)

CURLOPT\_DISALLOW\_USERNAME\_IN\_URL - disallow specifying username in the URL

# [SYNOPSIS](#SYNOPSIS)

```
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DISALLOW_USERNAME_IN_URL,


                          long disallow);
```

# [DESCRIPTION](#DESCRIPTION)

A long parameter set to 1 tells the library to not allow URLs set with [*CURLOPT\_URL(3)*](/man/os/curl/CURLOPT_URL.3) that include a username.

This is the equivalent to the *CURLU\_DISALLOW\_USER* flag for the [*curl\_url\_set(3)*](/man/os/curl/curl_url_set.3) function.

Note that this option does not affect URLs set with [*CURLOPT\_CURLU(3)*](/man/os/curl/CURLOPT_CURLU.3).

# [DEFAULT](#DEFAULT)

0 (disabled)

# [PROTOCOLS](#PROTOCOLS)

This functionality affects all supported protocols

# [EXAMPLE](#EXAMPLE)

```
int main(void)
{


  CURL *curl = curl_easy_init();


  if(curl) {


    CURLcode result;


    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");


    curl_easy_setopt(curl, CURLOPT_DISALLOW_USERNAME_IN_URL, 1L);


    result = curl_easy_perform(curl);


    curl_easy_cleanup(curl);


  }
}
```

# [AVAILABILITY](#AVAILABILITY)

Added in curl 7.61.0

# [RETURN VALUE](#RETURN_VALUE)

[*curl\_easy\_setopt(3)*](/man/os/curl/curl_easy_setopt.3) returns a CURLcode indicating success or error.

CURLE\_OK (0) means everything was OK, non-zero means an error occurred, see [*libcurl-errors(3)*](/man/os/curl/libcurl-errors.3).

[*curl\_easy\_perform(3)*](/man/os/curl/curl_easy_perform.3) returns CURLE\_LOGIN\_DENIED if this option is enabled and a URL containing a username is specified.

# [SEE ALSO](#SEE_ALSO)

[**CURLOPT\_PROTOCOLS\_STR**(3)](/man/os/curl/CURLOPT_PROTOCOLS_STR.3), [**CURLOPT\_URL**(3)](/man/os/curl/CURLOPT_URL.3), [**curl\_url\_set**(3)](/man/os/curl/curl_url_set.3), [**libcurl-security**(3)](/man/os/curl/libcurl-security.3)

2026-10-22 libcurl

---

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