CURLOPT_USERPWD.3 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2017, 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. .\" **************************************************************************
  22. .\"
  23. .TH CURLOPT_USERPWD 3 "17 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_USERPWD \- user name and password to use in authentication
  26. .SH SYNOPSIS
  27. #include <curl/curl.h>
  28. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERPWD, char *userpwd);
  29. .SH DESCRIPTION
  30. Pass a char * as parameter, pointing to a null-terminated login details string
  31. for the connection. The format of which is: [user name]:[password].
  32. When using Kerberos V5 authentication with a Windows based server, you should
  33. specify the user name part with the domain name in order for the server to
  34. successfully obtain a Kerberos Ticket. If you don't then the initial part of
  35. the authentication handshake may fail.
  36. When using NTLM, the user name can be specified simply as the user name
  37. without the domain name should the server be part of a single domain and
  38. forest.
  39. To specify the domain name use either Down-Level Logon Name or UPN (User
  40. Principal Name) formats. For example, EXAMPLE\\user and user@example.com
  41. respectively.
  42. Some HTTP servers (on Windows) support inclusion of the domain for Basic
  43. authentication as well.
  44. When using HTTP and \fICURLOPT_FOLLOWLOCATION(3)\fP, libcurl might perform
  45. several requests to possibly different hosts. libcurl will only send this user
  46. and password information to hosts using the initial host name (unless
  47. \fICURLOPT_UNRESTRICTED_AUTH(3)\fP is set), so if libcurl follows locations to
  48. other hosts it will not send the user and password to those. This is enforced
  49. to prevent accidental information leakage.
  50. Use \fICURLOPT_HTTPAUTH(3)\fP to specify the authentication method for HTTP
  51. based connections or \fICURLOPT_LOGIN_OPTIONS(3)\fP to control IMAP, POP3 and
  52. SMTP options.
  53. The user and password strings are not URL decoded, so there's no way to send
  54. in a user name containing a colon using this option. Use
  55. \fICURLOPT_USERNAME(3)\fP for that, or include it in the URL.
  56. The application does not have to keep the string around after setting this
  57. option.
  58. .SH DEFAULT
  59. NULL
  60. .SH PROTOCOLS
  61. Most
  62. .SH EXAMPLE
  63. .nf
  64. CURL *curl = curl_easy_init();
  65. if(curl) {
  66. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
  67. curl_easy_setopt(curl, CURLOPT_USERPWD, "clark:kent");
  68. ret = curl_easy_perform(curl);
  69. curl_easy_cleanup(curl);
  70. }
  71. .fi
  72. .SH AVAILABILITY
  73. Always
  74. .SH RETURN VALUE
  75. Returns CURLE_OK on success or
  76. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  77. .SH "SEE ALSO"
  78. .BR CURLOPT_USERNAME "(3), " CURLOPT_PASSWORD "(3), "
  79. .BR CURLOPT_PROXYUSERPWD "(3), "