---
name: "CURLOPT_DISALLOW_USERNAME_IN_URL"
section: "3"
platform: "macos"
package: "curl"
version: "166.0.0.0.1"
release: "macOS 26.5"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/CURLOPT_DISALLOW_USERNAME_IN_URL"
---

# CURLOPT\_DISALLOW\_USERNAME\_IN\_URL(3)

disallow specifying username in the URL

## NAME

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

## SYNOPSIS

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

## DESCRIPTION

A long parameter set to 1 tells the library to not allow URLs that include a username.

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

## DEFAULT

0 (disabled) - user names are allowed by default.

## PROTOCOLS

Several

## EXAMPLE

```
int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
    curl_easy_setopt(curl, CURLOPT_DISALLOW_USERNAME_IN_URL, 1L);
    curl_easy_perform(curl);
  }
}
```

## AVAILABILITY

Added in 7.61.0

## RETURN VALUE

Returns CURLE\_OK if the option is supported, and CURLE\_UNKNOWN\_OPTION if not.

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

## SEE ALSO

[**CURLOPT\_PROTOCOLS**(3)](/CURLOPT_PROTOCOLS/3.md), [**CURLOPT\_URL**(3)](/CURLOPT_URL/3.md), [**curl\_url\_set**(3)](/curl_url_set/3.md), [**libcurl-security**(3)](/libcurl-security/3.md)
