quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_USERPWD.md (2823B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_USERPWD
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_PASSWORD (3)
      9   - CURLOPT_PROXYUSERPWD (3)
     10   - CURLOPT_USERNAME (3)
     11 Protocol:
     12   - All
     13 Added-in: 7.1
     14 ---
     15 
     16 # NAME
     17 
     18 CURLOPT_USERPWD - username and password to use in authentication
     19 
     20 # SYNOPSIS
     21 
     22 ~~~c
     23 #include <curl/curl.h>
     24 
     25 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERPWD, char *userpwd);
     26 ~~~
     27 
     28 # DESCRIPTION
     29 
     30 Pass a char pointer as parameter, pointing to a null-terminated login details
     31 string for the connection. The format of which is: [username]:[password].
     32 
     33 When using Kerberos V5 authentication with a Windows based server, you should
     34 specify the username part with the domain name in order for the server to
     35 successfully obtain a Kerberos Ticket. If you do not then the initial part of
     36 the authentication handshake may fail.
     37 
     38 When using NTLM, the username can be specified simply as the username without
     39 the domain name should the server be part of a single domain and forest.
     40 
     41 To specify the domain name use either Down-Level Logon Name or UPN (User
     42 Principal Name) formats. For example **EXAMPLE\user** and **user@example.com**
     43 respectively.
     44 
     45 Some HTTP servers (on Windows) support inclusion of the domain for Basic
     46 authentication as well.
     47 
     48 When using HTTP and CURLOPT_FOLLOWLOCATION(3), libcurl might perform several
     49 requests to possibly different hosts. libcurl only sends this user and
     50 password information to hosts using the initial hostname (unless
     51 CURLOPT_UNRESTRICTED_AUTH(3) is set), so if libcurl follows redirects to other
     52 hosts, it does not send the user and password to those. This is enforced to
     53 prevent accidental information leakage.
     54 
     55 Use CURLOPT_HTTPAUTH(3) to specify the authentication method for HTTP
     56 based connections or CURLOPT_LOGIN_OPTIONS(3) to control IMAP, POP3 and
     57 SMTP options.
     58 
     59 The user and password strings are not URL decoded, so there is no way to send
     60 in a username containing a colon using this option. Use CURLOPT_USERNAME(3)
     61 for that, or include it in the URL.
     62 
     63 The application does not have to keep the string around after setting this
     64 option.
     65 
     66 Using this option multiple times makes the last set string override the
     67 previous ones. Set it to NULL to disable its use again.
     68 
     69 # DEFAULT
     70 
     71 NULL
     72 
     73 # %PROTOCOLS%
     74 
     75 # EXAMPLE
     76 
     77 ~~~c
     78 int main(void)
     79 {
     80   CURL *curl = curl_easy_init();
     81   if(curl) {
     82     CURLcode res;
     83     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
     84 
     85     curl_easy_setopt(curl, CURLOPT_USERPWD, "clark:kent");
     86 
     87     res = curl_easy_perform(curl);
     88 
     89     curl_easy_cleanup(curl);
     90   }
     91 }
     92 ~~~
     93 
     94 # %AVAILABILITY%
     95 
     96 # RETURN VALUE
     97 
     98 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     99 
    100 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
    101 libcurl-errors(3).