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