CURLOPT_DISALLOW_USERNAME_IN_URL.md (1357B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_DISALLOW_USERNAME_IN_URL 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_PROTOCOLS_STR (3) 9 - CURLOPT_URL (3) 10 - curl_url_set (3) 11 - libcurl-security (3) 12 Protocol: 13 - All 14 Added-in: 7.61.0 15 --- 16 17 # NAME 18 19 CURLOPT_DISALLOW_USERNAME_IN_URL - disallow specifying username in the URL 20 21 # SYNOPSIS 22 23 ~~~c 24 #include <curl/curl.h> 25 26 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DISALLOW_USERNAME_IN_URL, 27 long disallow); 28 ~~~ 29 30 # DESCRIPTION 31 32 A long parameter set to 1 tells the library to not allow URLs that include a 33 username. 34 35 This is the equivalent to the *CURLU_DISALLOW_USER* flag for the 36 curl_url_set(3) function. 37 38 # DEFAULT 39 40 0 (disabled) 41 42 # %PROTOCOLS% 43 44 # EXAMPLE 45 46 ~~~c 47 int 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 64 curl_easy_setopt(3) returns a CURLcode indicating success or error. 65 66 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 67 libcurl-errors(3). 68 69 curl_easy_perform(3) returns CURLE_LOGIN_DENIED if this option is 70 enabled and a URL containing a username is specified.