CURLOPT_USERPWD.3 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_USERPWD 3 "17 Jun 2014" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_USERPWD \- user name and password to use in authentication
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERPWD, char *userpwd);
  32. .fi
  33. .SH DESCRIPTION
  34. Pass a char * as parameter, pointing to a null-terminated login details string
  35. for the connection. The format of which is: [user name]:[password].
  36. When using Kerberos V5 authentication with a Windows based server, you should
  37. specify the user name part with the domain name in order for the server to
  38. successfully obtain a Kerberos Ticket. If you do not then the initial part of
  39. the authentication handshake may fail.
  40. When using NTLM, the user name can be specified simply as the user name
  41. without the domain name should the server be part of a single domain and
  42. forest.
  43. To specify the domain name use either Down-Level Logon Name or UPN (User
  44. Principal Name) formats. For example, EXAMPLE\\user and user@example.com
  45. respectively.
  46. Some HTTP servers (on Windows) support inclusion of the domain for Basic
  47. authentication as well.
  48. When using HTTP and \fICURLOPT_FOLLOWLOCATION(3)\fP, libcurl might perform
  49. several requests to possibly different hosts. libcurl will only send this user
  50. and password information to hosts using the initial host name (unless
  51. \fICURLOPT_UNRESTRICTED_AUTH(3)\fP is set), so if libcurl follows locations to
  52. other hosts it will not send the user and password to those. This is enforced
  53. to prevent accidental information leakage.
  54. Use \fICURLOPT_HTTPAUTH(3)\fP to specify the authentication method for HTTP
  55. based connections or \fICURLOPT_LOGIN_OPTIONS(3)\fP to control IMAP, POP3 and
  56. SMTP options.
  57. The user and password strings are not URL decoded, so there's no way to send
  58. in a user name containing a colon using this option. Use
  59. \fICURLOPT_USERNAME(3)\fP for that, or include it in the URL.
  60. The application does not have to keep the string around after setting this
  61. option.
  62. .SH DEFAULT
  63. NULL
  64. .SH PROTOCOLS
  65. Most
  66. .SH EXAMPLE
  67. .nf
  68. CURL *curl = curl_easy_init();
  69. if(curl) {
  70. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
  71. curl_easy_setopt(curl, CURLOPT_USERPWD, "clark:kent");
  72. ret = curl_easy_perform(curl);
  73. curl_easy_cleanup(curl);
  74. }
  75. .fi
  76. .SH AVAILABILITY
  77. Always
  78. .SH RETURN VALUE
  79. Returns CURLE_OK on success or
  80. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  81. .SH "SEE ALSO"
  82. .BR CURLOPT_USERNAME "(3), " CURLOPT_PASSWORD "(3), "
  83. .BR CURLOPT_PROXYUSERPWD "(3), "