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 (3)
9  - CURLOPT_URL (3)
10  - curl_url_set (3)
11  - libcurl-security (3)
12Protocol:
13  - All
14---
15
16# NAME
17
18CURLOPT_DISALLOW_USERNAME_IN_URL - disallow specifying username in the URL
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DISALLOW_USERNAME_IN_URL,
26                          long disallow);
27~~~
28
29# DESCRIPTION
30
31A long parameter set to 1 tells the library to not allow URLs that include a
32username.
33
34This is the equivalent to the *CURLU_DISALLOW_USER* flag for the
35curl_url_set(3) function.
36
37# DEFAULT
38
390 (disabled) - usernames are allowed by default.
40
41# EXAMPLE
42
43~~~c
44int main(void)
45{
46  CURL *curl = curl_easy_init();
47  if(curl) {
48
49    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
50    curl_easy_setopt(curl, CURLOPT_DISALLOW_USERNAME_IN_URL, 1L);
51
52    curl_easy_perform(curl);
53  }
54}
55~~~
56
57# AVAILABILITY
58
59Added in 7.61.0
60
61# RETURN VALUE
62
63Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
64
65curl_easy_perform(3) returns CURLE_LOGIN_DENIED if this option is
66enabled and a URL containing a username is specified.
67