1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_DISALLOW_USERNAME_IN_URL
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_PROTOCOLS_STR (3)
9  - CURLOPT_URL (3)
10  - curl_url_set (3)
11  - libcurl-security (3)
12Protocol:
13  - All
14Added-in: 7.61.0
15---
16
17# NAME
18
19CURLOPT_DISALLOW_USERNAME_IN_URL - disallow specifying username in the URL
20
21# SYNOPSIS
22
23~~~c
24#include <curl/curl.h>
25
26CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DISALLOW_USERNAME_IN_URL,
27                          long disallow);
28~~~
29
30# DESCRIPTION
31
32A long parameter set to 1 tells the library to not allow URLs that include a
33username.
34
35This is the equivalent to the *CURLU_DISALLOW_USER* flag for the
36curl_url_set(3) function.
37
38# DEFAULT
39
400 (disabled)
41
42# %PROTOCOLS%
43
44# EXAMPLE
45
46~~~c
47int main(void)
48{
49  CURL *curl = curl_easy_init();
50  if(curl) {
51
52    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
53    curl_easy_setopt(curl, CURLOPT_DISALLOW_USERNAME_IN_URL, 1L);
54
55    curl_easy_perform(curl);
56  }
57}
58~~~
59
60# %AVAILABILITY%
61
62# RETURN VALUE
63
64Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
65
66curl_easy_perform(3) returns CURLE_LOGIN_DENIED if this option is
67enabled and a URL containing a username is specified.
68