CURLOPT_NETRC.3 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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.haxx.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_NETRC 3 "17 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_NETRC \- request that .netrc is used
  26. .SH SYNOPSIS
  27. #include <curl/curl.h>
  28. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NETRC, long level);
  29. .SH DESCRIPTION
  30. This parameter controls the preference \fIlevel\fP of libcurl between using
  31. user names and passwords from your \fI~/.netrc\fP file, relative to user names
  32. and passwords in the URL supplied with \fICURLOPT_URL(3)\fP. On Windows,
  33. libcurl will use the file as \fI%HOME%/_netrc\fP, but you can also tell
  34. libcurl a different file name to use with \fICURLOPT_NETRC_FILE(3)\fP.
  35. libcurl uses a user name (and supplied or prompted password) supplied with
  36. \fICURLOPT_USERPWD(3)\fP or \fICURLOPT_USERNAME(3)\fP in preference to any of
  37. the options controlled by this parameter.
  38. Only machine name, user name and password are taken into account (init macros
  39. and similar things aren't supported).
  40. libcurl does not verify that the file has the correct properties set (as the
  41. standard Unix ftp client does). It should only be readable by user.
  42. \fIlevel\fP should be set to one of the values described below.
  43. .IP CURL_NETRC_OPTIONAL
  44. The use of the \fI~/.netrc\fP file is optional, and information in the URL is
  45. to be preferred. The file will be scanned for the host and user name (to find
  46. the password only) or for the host only, to find the first user name and
  47. password after that \fImachine\fP, which ever information is not specified.
  48. Undefined values of the option will have this effect.
  49. .IP CURL_NETRC_IGNORED
  50. The library will ignore the \fI~/.netrc\fP file.
  51. This is the default.
  52. .IP CURL_NETRC_REQUIRED
  53. The use of the \fI~/.netrc\fP file is required, and information in the URL is
  54. to be ignored. The file will be scanned for the host and user name (to find
  55. the password only) or for the host only, to find the first user name and
  56. password after that \fImachine\fP, which ever information is not specified.
  57. .SH DEFAULT
  58. CURL_NETRC_IGNORED
  59. .SH PROTOCOLS
  60. Most
  61. .SH EXAMPLE
  62. .nf
  63. CURL *curl = curl_easy_init();
  64. if(curl) {
  65. CURLcode ret;
  66. curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/");
  67. curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
  68. ret = curl_easy_perform(curl);
  69. }
  70. .fi
  71. .SH AVAILABILITY
  72. Always
  73. .SH RETURN VALUE
  74. Returns CURLE_OK
  75. .SH "SEE ALSO"
  76. .BR CURLOPT_USERPWD "(3), " CURLOPT_USERNAME "(3), " CURLOPT_NETRC_FILE "(3), "