curl_easy_setopt.3 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2004, 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 http://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. .\" * $Id: curl_easy_setopt.3,v 1.82 2004/03/12 09:14:45 bagder Exp $
  22. .\" **************************************************************************
  23. .\"
  24. .TH curl_easy_setopt 3 "12 Mar 2004" "libcurl 7.11.1" "libcurl Manual"
  25. .SH NAME
  26. curl_easy_setopt - set options for a curl easy handle
  27. .SH SYNOPSIS
  28. #include <curl/curl.h>
  29. CURLcode curl_easy_setopt(CURL *handle, CURLoption option, parameter);
  30. .SH DESCRIPTION
  31. curl_easy_setopt() is used to tell libcurl how to behave. By using the
  32. appropriate options to \fIcurl_easy_setopt\fP, you can change libcurl's
  33. behavior. All options are set with the \fIoption\fP followed by a
  34. \fIparameter\fP. That parameter can be a long, a function pointer or an object
  35. pointer, all depending on what the specific option expects. Read this manual
  36. carefully as bad input values may cause libcurl to behave badly! You can only
  37. set one option in each function call. A typical application uses many
  38. curl_easy_setopt() calls in the setup phase.
  39. Options set with this function call are valid for all forthcoming transfers
  40. performed using this \fIhandle\fP. The options are not in any way reset
  41. between transfers, so if you want subsequent transfers with different options,
  42. you must change them between the transfers.
  43. \fBNOTE:\fP strings passed to libcurl as 'char *' arguments, will not be
  44. copied by the library. Instead you should keep them available until libcurl no
  45. longer needs them. Failing to do so will cause very odd behavior or even
  46. crashes. libcurl will need them until you call \fIcurl_easy_cleanup(3)\fP or
  47. you set the same option again to use a different pointer.
  48. The \fIhandle\fP is the return code from a \fIcurl_easy_init(3)\fP or
  49. \fIcurl_easy_duphandle(3)\fP call.
  50. .SH BEHAVIOR OPTIONS
  51. .IP CURLOPT_VERBOSE
  52. Set the parameter to non-zero to get the library to display a lot of verbose
  53. information about its operations. Very useful for libcurl and/or protocol
  54. debugging and understanding. The verbose information will be sent to stderr,
  55. or the stream set with \fICURLOPT_STDERR\fP.
  56. You hardly ever want this set in production use, you will almost always want
  57. this when you debug/report problems. Another neat option for debugging is the
  58. \fICURLOPT_DEBUGFUNCTION\fP.
  59. .IP CURLOPT_HEADER
  60. A non-zero parameter tells the library to include the header in the body
  61. output. This is only relevant for protocols that actually have headers
  62. preceding the data (like HTTP).
  63. .IP CURLOPT_NOPROGRESS
  64. A non-zero parameter tells the library to shut off the built-in progress meter
  65. completely.
  66. \fBNOTE:\fP future versions of libcurl is likely to not have any built-in
  67. progress meter at all.
  68. .IP CURLOPT_NOSIGNAL
  69. Pass a long. If it is non-zero, libcurl will not use any functions that
  70. install signal handlers or any functions that cause signals to be sent to the
  71. process. This option is mainly here to allow multi-threaded unix applications
  72. to still set/use all timeout options etc, without risking getting signals.
  73. (Added in 7.10)
  74. Consider building libcurl with ares support to enable asynchronous DNS
  75. lookups. It enables nice timeouts for name resolves without signals.
  76. .PP
  77. .SH CALLBACK OPTIONS
  78. .IP CURLOPT_WRITEFUNCTION
  79. Function pointer that should match the following prototype: \fBsize_t
  80. function( void *ptr, size_t size, size_t nmemb, void *stream);\fP This
  81. function gets called by libcurl as soon as there is data reveiced that needs
  82. to be saved. The size of the data pointed to by \fIptr\fP is \fIsize\fP
  83. multiplied with \fInmemb\fP, it will not be zero terminated. Return the number
  84. of bytes actually taken care of. If that amount differs from the amount passed
  85. to your function, it'll signal an error to the library and it will abort the
  86. transfer and return \fICURLE_WRITE_ERROR\fP.
  87. Set the \fIstream\fP argument with the \fICURLOPT_WRITEDATA\fP option.
  88. \fBNOTE:\fP you will be passed as much data as possible in all invokes, but
  89. you cannot possibly make any assumptions. It may be one byte, it may be
  90. thousands. The maximum amount of data that can be passed to the write callback
  91. is defined in the curl.h header file: CURL_MAX_WRITE_SIZE.
  92. .IP CURLOPT_WRITEDATA
  93. Data pointer to pass to the file write function. Note that if you specify the
  94. \fICURLOPT_WRITEFUNCTION\fP, this is the pointer you'll get as input. If you
  95. don't use a callback, you must pass a 'FILE *' as libcurl will pass this to
  96. fwrite() when writing data.
  97. \fBNOTE:\fP If you're using libcurl as a win32 DLL, you MUST use the
  98. \fICURLOPT_WRITEFUNCTION\fP if you set this option or you will experience
  99. crashes.
  100. This option is also known with the older name \fICURLOPT_FILE\fP, the name
  101. \fICURLOPT_WRITEDATA\fP was introduced in 7.9.7.
  102. .IP CURLOPT_READFUNCTION
  103. Function pointer that should match the following prototype: \fBsize_t
  104. function( void *ptr, size_t size, size_t nmemb, void *stream);\fP This
  105. function gets called by libcurl as soon as it needs to read data in order to
  106. send it to the peer. The data area pointed at by the pointer \fIptr\fP may be
  107. filled with at most \fIsize\fP multiplied with \fInmemb\fP number of
  108. bytes. Your function must return the actual number of bytes that you stored in
  109. that memory area. Returning 0 will signal end-of-file to the library and cause
  110. it to stop the current transfer.
  111. .IP CURLOPT_READDATA
  112. Data pointer to pass to the file read function. Note that if you specify the
  113. \fICURLOPT_READFUNCTION\fP, this is the pointer you'll get as input. If you
  114. don't specify a read callback, this must be a valid FILE *.
  115. \fBNOTE:\fP If you're using libcurl as a win32 DLL, you MUST use a
  116. \fICURLOPT_READFUNCTION\fP if you set this option.
  117. This option is also known with the older name \fICURLOPT_INFILE\fP, the name
  118. \fICURLOPT_READDATA\fP was introduced in 7.9.7.
  119. .IP CURLOPT_PROGRESSFUNCTION
  120. Function pointer that should match the \fIcurl_progress_callback\fP prototype
  121. found in \fI<curl/curl.h>\fP. This function gets called by libcurl instead of
  122. its internal equivalent with a frequent interval during data transfer.
  123. Unknown/unused argument values will be set to zero (like if you only download
  124. data, the upload size will remain 0). Returning a non-zero value from this
  125. callback will cause libcurl to abort the transfer and return
  126. \fICURLE_ABORTED_BY_CALLBACK\fP.
  127. Also note that \fICURLOPT_NOPROGRESS\fP must be set to FALSE to make this
  128. function actually get called.
  129. .IP CURLOPT_PROGRESSDATA
  130. Pass a pointer that will be untouched by libcurl and passed as the first
  131. argument in the progress callback set with \fICURLOPT_PROGRESSFUNCTION\fP.
  132. .IP CURLOPT_HEADERFUNCTION
  133. Function pointer that should match the following prototype: \fIsize_t
  134. function( void *ptr, size_t size, size_t nmemb, void *stream);\fP. This
  135. function gets called by libcurl as soon as there is received header data that
  136. needs to be written down. The headers are guaranteed to be written one-by-one
  137. and only complete lines are written. Parsing headers should be easy enough
  138. using this. The size of the data pointed to by \fIptr\fP is \fIsize\fP
  139. multiplied with \fInmemb\fP. The pointer named \fIstream\fP will be the one
  140. you passed to libcurl with the \fICURLOPT_WRITEHEADER\fP option. Return the
  141. number of bytes actually written or return -1 to signal error to the library
  142. (it will cause it to abort the transfer with a \fICURLE_WRITE_ERROR\fP return
  143. code).
  144. .IP CURLOPT_WRITEHEADER
  145. Pass a pointer to be used to write the header part of the received data to. If
  146. you don't use your own callback to take care of the writing, this must be a
  147. valid FILE *. See also the \fICURLOPT_HEADERFUNCTION\fP option above on how to
  148. set a custom get-all-headers callback.
  149. .IP CURLOPT_DEBUGFUNCTION
  150. Function pointer that should match the following prototype: \fIint
  151. curl_debug_callback (CURL *, curl_infotype, char *, size_t, void *);\fP
  152. \fICURLOPT_DEBUGFUNCTION\fP replaces the standard debug function used when
  153. \fICURLOPT_VERBOSE \fP is in effect. This callback receives debug information,
  154. as specified with the \fBcurl_infotype\fP argument. This funtion must return
  155. 0. The data pointed to by the char * passed to this function WILL NOT be zero
  156. terminated, but will be exactly of the size as told by the size_t argument.
  157. Available curl_infotype values:
  158. .RS
  159. .IP CURLINFO_TEXT
  160. The data is informational text.
  161. .IP CURLINFO_HEADER_IN
  162. The data is header (or header-like) data received from the peer.
  163. .IP CURLINFO_HEADER_OUT
  164. The data is header (or header-like) data sent to the peer.
  165. .IP CURLINFO_DATA_IN
  166. The data is protocol data received from the peer.
  167. .IP CURLINFO_DATA_OUT
  168. The data is protocol data sent to the peer.
  169. .RE
  170. .IP CURLOPT_DEBUGDATA
  171. Pass a pointer to whatever you want passed in to your
  172. \fICURLOPT_DEBUGFUNCTION\fP in the last void * argument. This pointer is not
  173. used by libcurl, it is only passed to the callback.
  174. .IP CURLOPT_SSL_CTX_FUNCTION
  175. Function pointer that should match the following prototype: \fBCURLcode
  176. sslctxfun(CURL *curl, void *sslctx, void *parm);\fP This function gets called
  177. by libcurl just before the initialization of an SSL connection after having
  178. processed all other SSL related options to give a last chance to an
  179. application to modify the behaviour of openssl's ssl initilaization. The
  180. \fIsslctx\fP parameter is actually a pointer to an openssl \fISSL_CTX\fP. If
  181. an error is returned no attempt to establish a connection is made and the
  182. perform operation will return the error code from this callback function. Set
  183. the \fIparm\fP argument with the \fICURLOPT_SSL_CTX_DATA\fP option. This
  184. option was introduced in 7.11.0.
  185. \fBNOTE:\fP To use this properly, a non-trivial amount of knowledge of the
  186. openssl libraries is necessary. Using this function allows for example to use
  187. openssl callbacks to add additional validation code for certificates, and even
  188. to change the actual URI of an HTTPS request (example used in the lib509 test
  189. case). See also the example section for a replacement of the key, certificate
  190. and trust file settings.
  191. .IP CURLOPT_SSL_CTX_DATA
  192. Data pointer to pass to the ssl context callback set by the option
  193. \fICURLOPT_SSL_CTX_FUNCTION\fP, this is the pointer you'll get as third
  194. parameter, otherwise \fBNULL\fP. (Added in 7.11.0)
  195. .SH ERROR OPTIONS
  196. .IP CURLOPT_ERRORBUFFER
  197. Pass a char * to a buffer that the libcurl may store human readable error
  198. messages in. This may be more helpful than just the return code from the
  199. library. The buffer must be at least CURL_ERROR_SIZE big.
  200. Use \fICURLOPT_VERBOSE\fP and \fICURLOPT_DEBUGFUNCTION\fP to better
  201. debug/trace why errors happen.
  202. \fBNote:\fP if the library does not return an error, the buffer may not have
  203. been touched. Do not rely on the contents in those cases.
  204. .IP CURLOPT_STDERR
  205. Pass a FILE * as parameter. Tell libcurl to use this stream instead of stderr
  206. when showing the progress meter and displaying \fICURLOPT_VERBOSE\fP data.
  207. .IP CURLOPT_FAILONERROR
  208. A non-zero parameter tells the library to fail silently if the HTTP code
  209. returned is equal to or larger than 300. The default action would be to return
  210. the page normally, ignoring that code.
  211. .SH NETWORK OPTIONS
  212. .IP CURLOPT_URL
  213. The actual URL to deal with. The parameter should be a char * to a zero
  214. terminated string. The string must remain present until curl no longer needs
  215. it, as it doesn't copy the string.
  216. If the given URL lacks the protocol part ("http://" or "ftp://" etc), it will
  217. attempt to guess which protocol to use based on the given host name. If the
  218. given protocol of the set URL is not supported, libcurl will return on error
  219. (\fICURLE_UNSUPPORTED_PROTOCOL\fP) when you call \fIcurl_easy_perform(3)\fP or
  220. \fIcurl_multi_perform(3)\fP. Use \fIcurl_version_info(3)\fP for detailed info
  221. on which protocols that are supported.
  222. \fBNOTE:\fP \fICURLOPT_URL\fP is the only option that must be set before
  223. \fIcurl_easy_perform(3)\fP is called.
  224. .IP CURLOPT_PROXY
  225. Set HTTP proxy to use. The parameter should be a char * to a zero terminated
  226. string holding the host name or dotted IP address. To specify port number in
  227. this string, append :[port] to the end of the host name. The proxy string may
  228. be prefixed with [protocol]:// since any such prefix will be ignored. The
  229. proxy's port number may optionally be specified with the separate option
  230. \fICURLOPT_PROXYPORT\fP.
  231. \fBNOTE:\fP when you tell the library to use a HTTP proxy, libcurl will
  232. transparently convert operations to HTTP even if you specify a FTP URL
  233. etc. This may have an impact on what other features of the library you can
  234. use, such as \fICURLOPT_QUOTE\fP and similar FTP specifics that don't work
  235. unless you tunnel through the HTTP proxy. Such tunneling is activated with
  236. \fICURLOPT_HTTPPROXYTUNNEL\fP.
  237. \fBNOTE2:\fP libcurl respects the environment variables \fBhttp_proxy\fP,
  238. \fBftp_proxy\fP, \fBall_proxy\fP etc, if any of those is set.
  239. .IP CURLOPT_PROXYPORT
  240. Pass a long with this option to set the proxy port to connect to unless it is
  241. specified in the proxy string \fICURLOPT_PROXY\fP.
  242. .IP CURLOPT_PROXYTYPE
  243. Pass a long with this option to set type of the proxy. Available options for
  244. this are \fICURLPROXY_HTTP\fP and \fICURLPROXY_SOCKS5\fP, with the HTTP one
  245. being default. (Added in 7.10)
  246. .IP CURLOPT_HTTPPROXYTUNNEL
  247. Set the parameter to non-zero to get the library to tunnel all operations
  248. through a given HTTP proxy. Note that there is a big difference between using
  249. a proxy and to tunnel through it. If you don't know what this means, you
  250. probably don't want this tunneling option.
  251. .IP CURLOPT_INTERFACE
  252. Pass a char * as parameter. This set the interface name to use as outgoing
  253. network interface. The name can be an interface name, an IP address or a host
  254. name.
  255. .IP CURLOPT_DNS_CACHE_TIMEOUT
  256. Pass a long, this sets the timeout in seconds. Name resolves will be kept in
  257. memory for this number of seconds. Set to zero (0) to completely disable
  258. caching, or set to -1 to make the cached entries remain forever. By default,
  259. libcurl caches this info for 60 seconds.
  260. .IP CURLOPT_DNS_USE_GLOBAL_CACHE
  261. Pass a long. If the value is non-zero, it tells curl to use a global DNS cache
  262. that will survive between easy handle creations and deletions. This is not
  263. thread-safe and this will use a global varible.
  264. \fBWARNING:\fP this option is considered obsolete. Stop using it. Switch over
  265. to using the share interface instead! See \fICURLOPT_SHARE\fP and
  266. \fIcurl_share_init(3)\fP.
  267. .IP CURLOPT_BUFFERSIZE
  268. Pass a long specifying your prefered size for the receive buffer in libcurl.
  269. The main point of this would be that the write callback gets called more often
  270. and with smaller chunks. This is just treated as a request, not an order. You
  271. cannot be guaranteed to actually get the given size. (Added in 7.10)
  272. .IP CURLOPT_PORT
  273. Pass a long specifying what remote port number to connect to, instead of the
  274. one specified in the URL or the default port for the used protocol.
  275. .SH NAMES and PASSWORDS OPTIONS (Authentication)
  276. .IP CURLOPT_NETRC
  277. This parameter controls the preference of libcurl between using user names and
  278. passwords from your \fI~/.netrc\fP file, relative to user names and passwords
  279. in the URL supplied with \fICURLOPT_URL\fP.
  280. \fBNote:\fP libcurl uses a user name (and supplied or prompted password)
  281. supplied with \fICURLOPT_USERPWD\fP in preference to any of the options
  282. controlled by this parameter.
  283. Pass a long, set to one of the values described below.
  284. .RS
  285. .IP CURL_NETRC_OPTIONAL
  286. The use of your \fI~/.netrc\fP file is optional,
  287. and information in the URL is to be preferred. The file will be scanned
  288. with the host and user name (to find the password only) or with the host only,
  289. to find the first user name and password after that \fImachine\fP,
  290. which ever information is not specified in the URL.
  291. Undefined values of the option will have this effect.
  292. .IP CURL_NETRC_IGNORED
  293. The library will ignore the file and use only the information in the URL.
  294. This is the default.
  295. .IP CURL_NETRC_REQUIRED
  296. This value tells the library that use of the file is required,
  297. to ignore the information in the URL,
  298. and to search the file with the host only.
  299. .RE
  300. Only machine name, user name and password are taken into account
  301. (init macros and similar things aren't supported).
  302. \fBNote:\fP libcurl does not verify that the file has the correct properties
  303. set (as the standard Unix ftp client does). It should only be readable by
  304. user.
  305. .IP CURLOPT_NETRC_FILE
  306. Pass a char * as parameter, pointing to a zero terminated string containing
  307. the full path name to the file you want libcurl to use as .netrc file. If this
  308. option is omitted, and \fICURLOPT_NETRC\fP is set, libcurl will attempt to
  309. find the a .netrc file in the current user's home directory. (Added in 7.10.9)
  310. .IP CURLOPT_USERPWD
  311. Pass a char * as parameter, which should be [user name]:[password] to use for
  312. the connection. Use \fICURLOPT_HTTPAUTH\fP to decide authentication method.
  313. When using HTTP and \fICURLOPT_FOLLOWLOCATION\fP, libcurl might perform
  314. several requests to possibly different hosts. libcurl will only send this user
  315. and password information to hosts using the initial host name (unless
  316. \fICURLOPT_UNRESTRICTED_AUTH\fP is set), so if libcurl follows locations to
  317. other hosts it will not send the user and password to those. This is enforced
  318. to prevent accidental information leakage.
  319. .IP CURLOPT_PROXYUSERPWD
  320. Pass a char * as parameter, which should be [user name]:[password] to use for
  321. the connection to the HTTP proxy. Use \fICURLOPT_PROXYAUTH\fP to decide
  322. authentication method.
  323. .IP CURLOPT_HTTPAUTH
  324. Pass a long as parameter, which is set to a bitmask, to tell libcurl what
  325. authentication method(s) you want it to use. The available bits are listed
  326. below. If more than one bit is set, libcurl will first query the site to see
  327. what authentication methods it supports and then pick the best one you allow
  328. it to use. Note that for some methods, this will induce an extra network
  329. round-trip. Set the actual name and password with the \fICURLOPT_USERPWD\fP
  330. option. (Added in 7.10.6)
  331. .RS
  332. .IP CURLAUTH_BASIC
  333. HTTP Basic authentication. This is the default choice, and the only method
  334. that is in wide-spread use and supported virtually everywhere. This is sending
  335. the user name and password over the network in plain text, easily captured by
  336. others.
  337. .IP CURLAUTH_DIGEST
  338. HTTP Digest authentication. Digest authentication is defined in RFC2617 and
  339. is a more secure way to do authentication over public networks than the
  340. regular old-fashioned Basic method.
  341. .IP CURLAUTH_GSSNEGOTIATE
  342. HTTP GSS-Negotiate authentication. The GSS-Negotiate (also known as plain
  343. "Negotiate") method was designed by Microsoft and is used in their web
  344. aplications. It is primarily meant as a support for Kerberos5 authentication
  345. but may be also used along with another authentication methods. For more
  346. information see IETF draft draft-brezak-spnego-http-04.txt.
  347. \fBNOTE\fP that you need to build libcurl with a suitable GSS-API library for
  348. this to work.
  349. .IP CURLAUTH_NTLM
  350. HTTP NTLM authentication. A proprietary protocol invented and used by
  351. Microsoft. It uses a challenge-response and hash concept similar to Digest, to
  352. prevent the password from being evesdropped.
  353. \fBNOTE\fP that you need to build libcurl with SSL support for this option to
  354. work.
  355. .IP CURLAUTH_ANY
  356. This is a convenience macro that sets all bits and thus makes libcurl pick any
  357. it finds suitable. libcurl will automaticly select the one it finds most
  358. secure.
  359. .IP CURLAUTH_ANYSAFE
  360. This is a convenience macro that sets all bits except Basic and thus makes
  361. libcurl pick any it finds suitable. libcurl will automaticly select the one it
  362. finds most secure.
  363. .RE
  364. .IP CURLOPT_PROXYAUTH
  365. Pass a long as parameter, which is set to a bitmask, to tell libcurl what
  366. authentication method(s) you want it to use for your proxy authentication. If
  367. more than one bit is set, libcurl will first query the site to see what
  368. authentication methods it supports and then pick the best one you allow it to
  369. use. Note that for some methods, this will induce an extra network
  370. round-trip. Set the actual name and password with the
  371. \fICURLOPT_PROXYUSERPWD\fP option. The bitmask can be constructed by or'ing
  372. together the bits listed above for the \fICURLOPT_HTTPAUTH\fP option. As of
  373. this writing, only Basic and NTLM work. (Added in 7.10.7)
  374. .SH HTTP OPTIONS
  375. .IP CURLOPT_AUTOREFERER
  376. Pass a non-zero parameter to enable this. When enabled, libcurl will
  377. automaticly set the Referer: field in requests where it follows a Location:
  378. redirect.
  379. .IP CURLOPT_ENCODING
  380. Sets the contents of the Accept-Encoding: header sent in an HTTP
  381. request, and enables decoding of a response when a Content-Encoding:
  382. header is received. Three encodings are supported: \fIidentity\fP,
  383. which does nothing, \fIdeflate\fP which requests the server to
  384. compress its response using the zlib algorithm, and \fIgzip\fP which
  385. requests the gzip algorithm. If a zero-length string is set, then an
  386. Accept-Encoding: header containing all supported encodings is sent.
  387. This is a request, not an order; the server may or may not do it. This
  388. option must be set (to any non-NULL value) or else any unsolicited
  389. encoding done by the server is ignored. See the special file
  390. lib/README.encoding for details.
  391. .IP CURLOPT_FOLLOWLOCATION
  392. A non-zero parameter tells the library to follow any Location: header that the
  393. server sends as part of a HTTP header.
  394. \fBNOTE:\fP this means that the library will re-send the same request on the
  395. new location and follow new Location: headers all the way until no more such
  396. headers are returned. \fICURLOPT_MAXREDIRS\fP can be used to limit the number
  397. of redirects libcurl will follow.
  398. .IP CURLOPT_UNRESTRICTED_AUTH
  399. A non-zero parameter tells the library it can continue to send authentication
  400. (user+password) when following locations, even when hostname changed. Note
  401. that this is meaningful only when setting \fICURLOPT_FOLLOWLOCATION\fP.
  402. .IP CURLOPT_MAXREDIRS
  403. Pass a long. The set number will be the redirection limit. If that many
  404. redirections have been followed, the next redirect will cause an error
  405. (\fICURLE_TOO_MANY_REDIRECTS\fP). This option only makes sense if the
  406. \fICURLOPT_FOLLOWLOCATION\fP is used at the same time.
  407. .IP CURLOPT_PUT
  408. A non-zero parameter tells the library to use HTTP PUT to transfer data. The
  409. data should be set with \fICURLOPT_READDATA\fP and \fICURLOPT_INFILESIZE\fP.
  410. .IP CURLOPT_POST
  411. A non-zero parameter tells the library to do a regular HTTP post. This is a
  412. normal application/x-www-form-urlencoded kind, which is the most commonly used
  413. one by HTML forms. See the \fICURLOPT_POSTFIELDS\fP option for how to specify
  414. the data to post and \fICURLOPT_POSTFIELDSIZE\fP in how to set the data
  415. size. Using the \fICURLOPT_POSTFIELDS\fP option implies this option.
  416. .IP CURLOPT_POSTFIELDS
  417. Pass a char * as parameter, which should be the full data to post in a HTTP
  418. post operation. You need to make sure that the data is formatted the way you
  419. want the server to receive it. libcurl will not convert or encode it for
  420. you. Most web servers will assume this data to be url-encoded. Take note.
  421. This POST is a normal application/x-www-form-urlencoded kind (and libcurl will
  422. set that Content-Type by default when this option is used), which is the most
  423. commonly used one by HTML forms. See also the \fICURLOPT_POST\fP. Using
  424. \fICURLOPT_POSTFIELDS\fP implies \fICURLOPT_POST\fP.
  425. \fBNote:\fP to make multipart/formdata posts (aka rfc1867-posts), check out
  426. the \fICURLOPT_HTTPPOST\fP option.
  427. .IP CURLOPT_POSTFIELDSIZE
  428. If you want to post data to the server without letting libcurl do a strlen()
  429. to measure the data size, this option must be used. When this option is used
  430. you can post fully binary data, which otherwise is likely to fail. If this
  431. size is set to zero, the library will use strlen() to get the size.
  432. .IP CURLOPT_POSTFIELDSIZE_LARGE
  433. Pass a curl_off_t as parameter. Use this to set the size of the
  434. \fICURLOPT_POSTFIELDS\fP data to prevent libcurl from doing strlen() on the
  435. data to figure out the size. This is the large file version of the
  436. \fICURLOPT_POSTFIELDSIZE\fP option. (Added in 7.11.1)
  437. .IP CURLOPT_HTTPPOST
  438. Tells libcurl you want a multipart/formdata HTTP POST to be made and you
  439. instruct what data to pass on to the server. Pass a pointer to a linked list
  440. of HTTP post structs as parameter. The linked list should be a fully valid
  441. list of 'struct HttpPost' structs properly filled in. The best and most
  442. elegant way to do this, is to use \fIcurl_formadd(3)\fP as documented. The
  443. data in this list must remain intact until you close this curl handle again
  444. with \fIcurl_easy_cleanup(3)\fP.
  445. .IP CURLOPT_REFERER
  446. Pass a pointer to a zero terminated string as parameter. It will be used to
  447. set the Referer: header in the http request sent to the remote server. This
  448. can be used to fool servers or scripts. You can also set any custom header
  449. with \fICURLOPT_HTTPHEADER\fP.
  450. .IP CURLOPT_USERAGENT
  451. Pass a pointer to a zero terminated string as parameter. It will be used to
  452. set the User-Agent: header in the http request sent to the remote server. This
  453. can be used to fool servers or scripts. You can also set any custom header
  454. with \fICURLOPT_HTTPHEADER\fP.
  455. .IP CURLOPT_HTTPHEADER
  456. Pass a pointer to a linked list of HTTP headers to pass to the server in your
  457. HTTP request. The linked list should be a fully valid list of \fBstruct
  458. curl_slist\fP structs properly filled in. Use \fIcurl_slist_append(3)\fP to
  459. create the list and \fIcurl_slist_free_all(3)\fP to clean up an entire
  460. list. If you add a header that is otherwise generated and used by libcurl
  461. internally, your added one will be used instead. If you add a header with no
  462. contents as in 'Accept:' (no data on the right side of the colon), the
  463. internally used header will get disabled. Thus, using this option you can add
  464. new headers, replace internal headers and remove internal headers. The
  465. headers included in the linked list must not be CRLF-terminated, because
  466. curl adds CRLF after each header item. Failure to comply with this will
  467. result in strange bugs because the server will most likely ignore part
  468. of the headers you specified.
  469. The first line in a request (usually containing a GET or POST) is not a header
  470. and cannot be replaced using this option. Only the lines following the
  471. request-line are headers.
  472. \fBNOTE:\fPThe most commonly replaced headers have "shortcuts" in the options
  473. \fICURLOPT_COOKIE\fP, \fICURLOPT_USERAGENT\fP and \fICURLOPT_REFERER\fP.
  474. .IP CURLOPT_HTTP200ALIASES
  475. Pass a pointer to a linked list of aliases to be treated as valid HTTP 200
  476. responses. Some servers respond with a custom header response line. For
  477. example, IceCast servers respond with "ICY 200 OK". By including this string
  478. in your list of aliases, the response will be treated as a valid HTTP header
  479. line such as "HTTP/1.0 200 OK". (Added in 7.10.3)
  480. The linked list should be a fully valid list of struct curl_slist structs, and
  481. be properly filled in. Use \fIcurl_slist_append(3)\fP to create the list and
  482. \fIcurl_slist_free_all(3)\fP to clean up an entire list.
  483. \fBNOTE:\fPThe alias itself is not parsed for any version strings. So if your
  484. alias is "MYHTTP/9.9", Libcurl will not treat the server as responding with
  485. HTTP version 9.9. Instead Libcurl will use the value set by option
  486. \fICURLOPT_HTTP_VERSION\fP.
  487. .IP CURLOPT_COOKIE
  488. Pass a pointer to a zero terminated string as parameter. It will be used to
  489. set a cookie in the http request. The format of the string should be
  490. NAME=CONTENTS, where NAME is the cookie name and CONTENTS is what the cookie
  491. should contain.
  492. If you need to set mulitple cookies, you need to set them all using a single
  493. option and thus you need to concat them all in one single string. Set multiple
  494. cookies in one string like this: "name1=content1; name2=content2;" etc.
  495. Using this option multiple times will only make the latest string override the
  496. previously ones.
  497. .IP CURLOPT_COOKIEFILE
  498. Pass a pointer to a zero terminated string as parameter. It should contain the
  499. name of your file holding cookie data to read. The cookie data may be in
  500. Netscape / Mozilla cookie data format or just regular HTTP-style headers
  501. dumped to a file.
  502. Given an empty or non-existing file, this option will enable cookies for this
  503. curl handle, making it understand and parse received cookies and then use
  504. matching cookies in future request.
  505. .IP CURLOPT_COOKIEJAR
  506. Pass a file name as char *, zero terminated. This will make libcurl write all
  507. internally known cookies to the specified file when \fIcurl_easy_cleanup(3)\fP
  508. is called. If no cookies are known, no file will be created. Specify "-" to
  509. instead have the cookies written to stdout. Using this option also enables
  510. cookies for this session, so if you for example follow a location it will make
  511. matching cookies get sent accordingly.
  512. \fBNOTE:\fP If the cookie jar file can't be created or written to (when the
  513. \fIcurl_easy_cleanup(3)\fP is called), libcurl will not and cannot report an
  514. error for this. Using \fICURLOPT_VERBOSE\fP or \fICURLOPT_DEBUGFUNCTION\fP
  515. will get a warning to display, but that is the only visible feedback you get
  516. about this possibly lethal situation.
  517. .IP CURLOPT_COOKIESESSION
  518. Pass a long set to non-zero to mark this as a new cookie "session". It will
  519. force libcurl to ignore all cookies it is about to load that are "session
  520. cookies" from the previous session. By default, libcurl always stores and
  521. loads all cookies, independent if they are session cookies are not. Session
  522. cookies are cookies without expiry date and they are meant to be alive and
  523. existing for this "session" only.
  524. .IP CURLOPT_HTTPGET
  525. Pass a long. If the long is non-zero, this forces the HTTP request to get back
  526. to GET. Only really usable if POST, PUT or a custom request have been used
  527. previously using the same curl handle.
  528. .IP CURLOPT_HTTP_VERSION
  529. Pass a long, set to one of the values described below. They force libcurl to
  530. use the specific HTTP versions. This is not sensible to do unless you have a
  531. good reason.
  532. .RS
  533. .IP CURL_HTTP_VERSION_NONE
  534. We don't care about what version the library uses. libcurl will use whatever
  535. it thinks fit.
  536. .IP CURL_HTTP_VERSION_1_0
  537. Enforce HTTP 1.0 requests.
  538. .IP CURL_HTTP_VERSION_1_1
  539. Enforce HTTP 1.1 requests.
  540. .RE
  541. .SH FTP OPTIONS
  542. .IP CURLOPT_FTPPORT
  543. Pass a pointer to a zero terminated string as parameter. It will be used to
  544. get the IP address to use for the ftp PORT instruction. The PORT instruction
  545. tells the remote server to connect to our specified IP address. The string may
  546. be a plain IP address, a host name, an network interface name (under Unix) or
  547. just a '-' letter to let the library use your systems default IP
  548. address. Default FTP operations are passive, and thus won't use PORT.
  549. You disable PORT again and go back to using the passive version by setting
  550. this option to NULL.
  551. .IP CURLOPT_QUOTE
  552. Pass a pointer to a linked list of FTP commands to pass to the server prior to
  553. your ftp request. This will be done before any other FTP commands are issued
  554. (even before the CWD command). The linked list should be a fully valid list of
  555. 'struct curl_slist' structs properly filled in. Use \fIcurl_slist_append(3)\fP
  556. to append strings (commands) to the list, and clear the entire list afterwards
  557. with \fIcurl_slist_free_all(3)\fP. Disable this operation again by setting a
  558. NULL to this option.
  559. .IP CURLOPT_POSTQUOTE
  560. Pass a pointer to a linked list of FTP commands to pass to the server after
  561. your ftp transfer request. The linked list should be a fully valid list of
  562. struct curl_slist structs properly filled in as described for
  563. \fICURLOPT_QUOTE\fP. Disable this operation again by setting a NULL to this
  564. option.
  565. .IP CURLOPT_PREQUOTE
  566. Pass a pointer to a linked list of FTP commands to pass to the server after
  567. the transfer type is set. The linked list should be a fully valid list of
  568. struct curl_slist structs properly filled in as described for
  569. \fICURLOPT_QUOTE\fP. Disable this operation again by setting a NULL to this
  570. option.
  571. .IP CURLOPT_FTPLISTONLY
  572. A non-zero parameter tells the library to just list the names of an ftp
  573. directory, instead of doing a full directory listing that would include file
  574. sizes, dates etc.
  575. This causes an FTP NLST command to be sent. Beware that some FTP servers list
  576. only files in their response to NLST; they might not include subdirectories
  577. and symbolic links.
  578. .IP CURLOPT_FTPAPPEND
  579. A non-zero parameter tells the library to append to the remote file instead of
  580. overwrite it. This is only useful when uploading to a ftp site.
  581. .IP CURLOPT_FTP_USE_EPRT
  582. Pass a long. If the value is non-zero, it tells curl to use the EPRT (and
  583. LPRT) command when doing active FTP downloads (which is enabled by
  584. \fICURLOPT_FTPPORT\fP). Using EPRT means that it will first attempt to use
  585. EPRT and then LPRT before using PORT, but if you pass FALSE (zero) to this
  586. option, it will not try using EPRT or LPRT, only plain PORT. (Added in 7.10.5)
  587. .IP CURLOPT_FTP_USE_EPSV
  588. Pass a long. If the value is non-zero, it tells curl to use the EPSV command
  589. when doing passive FTP downloads (which it always does by default). Using EPSV
  590. means that it will first attempt to use EPSV before using PASV, but if you
  591. pass FALSE (zero) to this option, it will not try using EPSV, only plain PASV.
  592. .IP CURLOPT_FTP_CREATE_MISSING_DIRS
  593. Pass a long. If the value is non-zero, curl will attempt to create any remote
  594. directory that it fails to CWD into. CWD is the command that changes working
  595. directory. (Added in 7.10.7)
  596. .IP CURLOPT_FTP_RESPONSE_TIMEOUT
  597. Pass a long. Causes curl to set a timeout period (in seconds) on the amount
  598. of time that the server is allowed to take in order to generate a response
  599. message for a command before the session is considered hung. Note that while
  600. curl is waiting for a response, this value overrides \fICURLOPT_TIMEOUT\fP. It
  601. is recommended that if used in conjunction with \fICURLOPT_TIMEOUT\fP, you set
  602. \fICURLOPT_FTP_RESPONSE_TIMEOUT\fP to a value smaller than
  603. \fICURLOPT_TIMEOUT\fP. (Added in 7.10.8)
  604. .IP CURLOPT_FTP_SSL
  605. Pass a long using one of the values from below, to make libcurl use your
  606. desired level of SSL for the ftp transfer. (Added in 7.11.0)
  607. .RS
  608. .IP CURLFTPSSL_NONE
  609. Don't attempt to use SSL.
  610. .IP CURLFTPSSL_TRY
  611. Try using SSL, proceed as normal otherwise.
  612. .IP CURLFTPSSL_CONTROL
  613. Require SSL for the control connection or fail with \fICURLE_FTP_SSL_FAILED\fP.
  614. .IP CURLFTPSSL_ALL
  615. Require SSL for all communication or fail with \fICURLE_FTP_SSL_FAILED\fP.
  616. .RE
  617. .SH PROTOCOL OPTIONS
  618. .IP CURLOPT_TRANSFERTEXT
  619. A non-zero parameter tells the library to use ASCII mode for ftp transfers,
  620. instead of the default binary transfer. For LDAP transfers it gets the data in
  621. plain text instead of HTML and for win32 systems it does not set the stdout to
  622. binary mode. This option can be usable when transferring text data between
  623. systems with different views on certain characters, such as newlines or
  624. similar.
  625. .IP CURLOPT_CRLF
  626. Convert Unix newlines to CRLF newlines on transfers.
  627. .IP CURLOPT_RANGE
  628. Pass a char * as parameter, which should contain the specified range you
  629. want. It should be in the format "X-Y", where X or Y may be left out. HTTP
  630. transfers also support several intervals, separated with commas as in
  631. \fI"X-Y,N-M"\fP. Using this kind of multiple intervals will cause the HTTP
  632. server to send the response document in pieces (using standard MIME separation
  633. techniques).
  634. .IP CURLOPT_RESUME_FROM
  635. Pass a long as parameter. It contains the offset in number of bytes that you
  636. want the transfer to start from.
  637. .IP CURLOPT_RESUME_FROM_LARGE
  638. Pass an curl_off_t as parameter. It contains the offset in number of bytes
  639. that you want the transfer to start from. (Added in 7.11.0)
  640. .IP CURLOPT_CUSTOMREQUEST
  641. Pass a pointer to a zero terminated string as parameter. It will be user
  642. instead of GET or HEAD when doing a HTTP request, or instead of LIST or NLST
  643. when doing an ftp directory listing. This is useful for doing DELETE or other
  644. more or less obscure HTTP requests. Don't do this at will, make sure your
  645. server supports the command first.
  646. NOTE: many people have wrongly used this option to replace the entire request
  647. with their own, including multiple headers and POST contents. While that might
  648. work in many cases, it will cause libcurl to send invalid requests and it
  649. could possibly confuse the remote server badly. Use \fICURLOPT_POST\fP and
  650. \fICURLOPT_POSTFIELDS\fP to set POST data. Use \fICURLOPT_HTTPHEADER\fP to
  651. replace or extend the set of headers sent by libcurl. Use
  652. \fICURLOPT_HTTP_VERSION\fP to change HTTP version.
  653. .IP CURLOPT_FILETIME
  654. Pass a long. If it is a non-zero value, libcurl will attempt to get the
  655. modification date of the remote document in this operation. This requires that
  656. the remote server sends the time or replies to a time querying command. The
  657. \fIcurl_easy_getinfo(3)\fP function with the \fICURLINFO_FILETIME\fP argument
  658. can be used after a transfer to extract the received time (if any).
  659. .IP CURLOPT_NOBODY
  660. A non-zero parameter tells the library to not include the body-part in the
  661. output. This is only relevant for protocols that have separate header and body
  662. parts. On HTTP(S) servers, this will make libcurl do a HEAD request.
  663. .IP CURLOPT_INFILESIZE
  664. When uploading a file to a remote site, this option should be used to tell
  665. libcurl what the expected size of the infile is. This value should be passed
  666. as a long. See also \fICURLOPT_INFILESIZE_LARGE\fP.
  667. .IP CURLOPT_INFILESIZE_LARGE
  668. When uploading a file to a remote site, this option should be used to tell
  669. libcurl what the expected size of the infile is. This value should be passed
  670. as a curl_off_t. (Added in 7.11.0)
  671. .IP CURLOPT_UPLOAD
  672. A non-zero parameter tells the library to prepare for an upload. The
  673. \fICURLOPT_READDATA\fP and \fICURLOPT_INFILESIZE_LARGE\fP are also interesting
  674. for uploads.
  675. .IP CURLOPT_MAXFILESIZE
  676. Pass a long as parameter. This allows you to specify the maximum size (in
  677. bytes) of a file to download. If the file requested is larger than this value,
  678. the transfer will not start and CURLE_FILESIZE_EXCEEDED will be returned.
  679. NOTE: The file size is not always known prior to download, and for such files
  680. this option has no effect even if the file transfer ends up being larger than
  681. this given limit. This concerns both FTP and HTTP transfers.
  682. .IP CURLOPT_MAXFILESIZE_LARGE
  683. Pass a curl_off_t as parameter. This allows you to specify the maximum size
  684. (in bytes) of a file to download. If the file requested is larger than this
  685. value, the transfer will not start and \fICURLE_FILESIZE_EXCEEDED\fP will be
  686. returned. (Added in 7.11.0)
  687. NOTE: The file size is not always known prior to download, and for such files
  688. this option has no effect even if the file transfer ends up being larger than
  689. this given limit. This concerns both FTP and HTTP transfers.
  690. .IP CURLOPT_TIMECONDITION
  691. Pass a long as parameter. This defines how the \fICURLOPT_TIMEVALUE\fP time
  692. value is treated. You can set this parameter to \fICURL_TIMECOND_IFMODSINCE\fP
  693. or \fICURL_TIMECOND_IFUNMODSINCE\fP. This feature applies to HTTP and FTP.
  694. NOTE: The last modification time of a file is not always known and in such
  695. instances this feature will have no effect even if the given time condition
  696. would have not been met.
  697. .IP CURLOPT_TIMEVALUE
  698. Pass a long as parameter. This should be the time in seconds since 1 jan 1970,
  699. and the time will be used in a condition as specified with
  700. \fICURLOPT_TIMECONDITION\fP.
  701. .SH CONNECTION OPTIONS
  702. .IP CURLOPT_TIMEOUT
  703. Pass a long as parameter containing the maximum time in seconds that you allow
  704. the libcurl transfer operation to take. Normally, name lookups can take a
  705. considerable time and limiting operations to less than a few minutes risk
  706. aborting perfectly normal operations. This option will cause curl to use the
  707. SIGALRM to enable time-outing system calls.
  708. \fBNOTE:\fP this is not recommended to use in unix multi-threaded programs, as
  709. it uses signals unless \fICURLOPT_NOSIGNAL\fP (see above) is set.
  710. .IP CURLOPT_LOW_SPEED_LIMIT
  711. Pass a long as parameter. It contains the transfer speed in bytes per second
  712. that the transfer should be below during \fICURLOPT_LOW_SPEED_TIME\fP seconds
  713. for the library to consider it too slow and abort.
  714. .IP CURLOPT_LOW_SPEED_TIME
  715. Pass a long as parameter. It contains the time in seconds that the transfer
  716. should be below the \fICURLOPT_LOW_SPEED_LIMIT\fP for the library to consider
  717. it too slow and abort.
  718. .IP CURLOPT_MAXCONNECTS
  719. Pass a long. The set number will be the persistent connection cache size. The
  720. set amount will be the maximum amount of simultaneously open connections that
  721. libcurl may cache. Default is 5, and there isn't much point in changing this
  722. value unless you are perfectly aware of how this work and changes libcurl's
  723. behaviour. This concerns connection using any of the protocols that support
  724. persistent connections.
  725. When reaching the maximum limit, curl uses the \fICURLOPT_CLOSEPOLICY\fP to
  726. figure out which of the existing connections to close to prevent the number of
  727. open connections to increase.
  728. \fBNOTE:\fP if you already have performed transfers with this curl handle,
  729. setting a smaller MAXCONNECTS than before may cause open connections to get
  730. closed unnecessarily.
  731. .IP CURLOPT_CLOSEPOLICY
  732. Pass a long. This option sets what policy libcurl should use when the
  733. connection cache is filled and one of the open connections has to be closed to
  734. make room for a new connection. This must be one of the CURLCLOSEPOLICY_*
  735. defines. Use \fICURLCLOSEPOLICY_LEAST_RECENTLY_USED\fP to make libcurl close
  736. the connection that was least recently used, that connection is also least
  737. likely to be capable of re-use. Use \fICURLCLOSEPOLICY_OLDEST\fP to make
  738. libcurl close the oldest connection, the one that was created first among the
  739. ones in the connection cache. The other close policies are not support
  740. yet.
  741. .IP CURLOPT_FRESH_CONNECT
  742. Pass a long. Set to non-zero to make the next transfer use a new (fresh)
  743. connection by force. If the connection cache is full before this connection,
  744. one of the existing connections will be closed as according to the selected or
  745. default policy. This option should be used with caution and only if you
  746. understand what it does. Set this to 0 to have libcurl attempt re-using an
  747. existing connection (default behavior).
  748. .IP CURLOPT_FORBID_REUSE
  749. Pass a long. Set to non-zero to make the next transfer explicitly close the
  750. connection when done. Normally, libcurl keep all connections alive when done
  751. with one transfer in case there comes a succeeding one that can re-use them.
  752. This option should be used with caution and only if you understand what it
  753. does. Set to 0 to have libcurl keep the connection open for possibly later
  754. re-use (default behavior).
  755. .IP CURLOPT_CONNECTTIMEOUT
  756. Pass a long. It should contain the maximum time in seconds that you allow the
  757. connection to the server to take. This only limits the connection phase, once
  758. it has connected, this option is of no more use. Set to zero to disable
  759. connection timeout (it will then only timeout on the system's internal
  760. timeouts). See also the \fICURLOPT_TIMEOUT\fP option.
  761. \fBNOTE:\fP this is not recommended to use in unix multi-threaded programs, as
  762. it uses signals unless \fICURLOPT_NOSIGNAL\fP (see above) is set.
  763. .IP CURLOPT_IPRESOLVE
  764. Allows an application to select what kind of IP addresses to use when
  765. resolving host names. This is only interesting when using host names that
  766. resolve addresses using more than one version of IP. The allowed values are:
  767. .RS
  768. .IP CURL_IPRESOLVE_WHATEVER
  769. Default, resolves addresses to all IP versions that your system allows.
  770. .IP CURL_IPRESOLVE_V4
  771. Resolve to ipv4 addresses.
  772. .IP CURL_IPRESOLVE_V6
  773. Resolve to ipv6 addresses.
  774. .RE
  775. .SH SSL and SECURITY OPTIONS
  776. .IP CURLOPT_SSLCERT
  777. Pass a pointer to a zero terminated string as parameter. The string should be
  778. the file name of your certificate. The default format is "PEM" and can be
  779. changed with \fICURLOPT_SSLCERTTYPE\fP.
  780. .IP CURLOPT_SSLCERTTYPE
  781. Pass a pointer to a zero terminated string as parameter. The string should be
  782. the format of your certificate. Supported formats are "PEM" and "DER". (Added
  783. in 7.9.3)
  784. .IP CURLOPT_SSLCERTPASSWD
  785. Pass a pointer to a zero terminated string as parameter. It will be used as
  786. the password required to use the \fICURLOPT_SSLCERT\fP certificate.
  787. This option is replaced by \fICURLOPT_SSLKEYPASSWD\fP and should only be used
  788. for backward compatibility. You never needed a pass phrase to load a
  789. certificate but you need one to load your private key.
  790. .IP CURLOPT_SSLKEY
  791. Pass a pointer to a zero terminated string as parameter. The string should be
  792. the file name of your private key. The default format is "PEM" and can be
  793. changed with \fICURLOPT_SSLKEYTYPE\fP.
  794. .IP CURLOPT_SSLKEYTYPE
  795. Pass a pointer to a zero terminated string as parameter. The string should be
  796. the format of your private key. Supported formats are "PEM", "DER" and "ENG".
  797. \fBNOTE:\fPThe format "ENG" enables you to load the private key from a crypto
  798. engine. in this case \fICURLOPT_SSLKEY\fP is used as an identifier passed to
  799. the engine. You have to set the crypto engine with \fICURLOPT_SSLENGINE\fP.
  800. .IP CURLOPT_SSLKEYPASSWD
  801. Pass a pointer to a zero terminated string as parameter. It will be used as
  802. the password required to use the \fICURLOPT_SSLKEY\fP private key.
  803. .IP CURLOPT_SSLENGINE
  804. Pass a pointer to a zero terminated string as parameter. It will be used as
  805. the identifier for the crypto engine you want to use for your private
  806. key.
  807. \fBNOTE:\fPIf the crypto device cannot be loaded,
  808. \fICURLE_SSL_ENGINE_NOTFOUND\fP is returned.
  809. .IP CURLOPT_SSLENGINE_DEFAULT
  810. Sets the actual crypto engine as the default for (asymetric) crypto
  811. operations.
  812. \fBNOTE:\fPIf the crypto device cannot be set,
  813. \fICURLE_SSL_ENGINE_SETFAILED\fP is returned.
  814. .IP CURLOPT_SSLVERSION
  815. Pass a long as parameter. Set what version of SSL to attempt to use, 2 or
  816. 3. By default, the SSL library will try to solve this by itself although some
  817. servers make this difficult why you at times may have to use this option.
  818. .IP CURLOPT_SSL_VERIFYPEER
  819. Pass a long that is set to a zero value to stop curl from verifying the peer's
  820. certificate (7.10 starting setting this option to non-zero by default).
  821. Alternate certificates to verify against can be specified with the
  822. \fICURLOPT_CAINFO\fP option or a certificate directory can be specified with
  823. the \fICURLOPT_CAPATH\fP option. As of 7.10, curl installs a default bundle.
  824. \fICURLOPT_SSL_VERIFYHOST\fP may also need to be set to 1 or 0 if
  825. \fICURLOPT_SSL_VERIFYPEER\fP is disabled (it defaults to 2).
  826. .IP CURLOPT_CAINFO
  827. Pass a char * to a zero terminated string naming a file holding one or more
  828. certificates to verify the peer with. This only makes sense when used in
  829. combination with the \fICURLOPT_SSL_VERIFYPEER\fP option.
  830. .IP CURLOPT_CAPATH
  831. Pass a char * to a zero terminated string naming a directory holding multiple
  832. CA certificates to verify the peer with. The certificate directory must be
  833. prepared using the openssl c_rehash utility. This only makes sense when used
  834. in combination with the \fICURLOPT_SSL_VERIFYPEER\fP option. The
  835. \fICURLOPT_CAPATH\fP function apparently does not work in Windows due to some
  836. limitation in openssl. (Added in 7.9.8)
  837. .IP CURLOPT_RANDOM_FILE
  838. Pass a char * to a zero terminated file name. The file will be used to read
  839. from to seed the random engine for SSL. The more random the specified file is,
  840. the more secure the SSL connection will become.
  841. .IP CURLOPT_EGDSOCKET
  842. Pass a char * to the zero terminated path name to the Entropy Gathering Daemon
  843. socket. It will be used to seed the random engine for SSL.
  844. .IP CURLOPT_SSL_VERIFYHOST
  845. Pass a long. Set if we should verify the Common name from the peer certificate
  846. in the SSL handshake, set 1 to check existence, 2 to ensure that it matches
  847. the provided hostname. This is by default set to 2. (default changed in 7.10)
  848. .IP CURLOPT_SSL_CIPHER_LIST
  849. Pass a char *, pointing to a zero terminated string holding the list of
  850. ciphers to use for the SSL connection. The list must be syntactly correct, it
  851. consists of one or more cipher strings separated by colons. Commas or spaces
  852. are also acceptable separators but colons are normally used, \!, \- and \+ can
  853. be used as operators. Valid examples of cipher lists include 'RC4-SHA',
  854. \'SHA1+DES\', 'TLSv1' and 'DEFAULT'. The default list is normally set when you
  855. compile OpenSSL.
  856. You'll find more details about cipher lists on this URL:
  857. \fIhttp://www.openssl.org/docs/apps/ciphers.html\fP
  858. .IP CURLOPT_KRB4LEVEL
  859. Pass a char * as parameter. Set the krb4 security level, this also enables
  860. krb4 awareness. This is a string, 'clear', 'safe', 'confidential' or
  861. \&'private'. If the string is set but doesn't match one of these, 'private'
  862. will be used. Set the string to NULL to disable kerberos4. The kerberos
  863. support only works for FTP.
  864. .SH OTHER OPTIONS
  865. .IP CURLOPT_PRIVATE
  866. Pass a char * as parameter, pointing to data that should be associated with
  867. this curl handle. The pointer can subsequently be retrieved using
  868. \fIcurl_easy_getinfo(3)\fP with the CURLINFO_PRIVATE option. libcurl itself
  869. does nothing with this data. (Added in 7.10.3)
  870. .IP CURLOPT_SHARE
  871. Pass a share handle as a parameter. The share handle must have been created by
  872. a previous call to \fIcurl_share_init(3)\fP. Setting this option, will make
  873. this curl handle use the data from the shared handle instead of keeping the
  874. data to itself. This enables several curl handles to share data. If the curl
  875. handles are used simultaneously, you \fBMUST\fP use the locking methods in the
  876. share handle. See \fIcurl_share_setopt(3)\fP for details.
  877. .SH TELNET OPTIONS
  878. .IP CURLOPT_TELNETOPTIONS
  879. Provide a pointer to a curl_slist with variables to pass to the telnet
  880. negotiations. The variables should be in the format <option=value>. libcurl
  881. supports the options 'TTYPE', 'XDISPLOC' and 'NEW_ENV'. See the TELNET
  882. standard for details.
  883. .SH RETURN VALUE
  884. CURLE_OK (zero) means that the option was set properly, non-zero means an
  885. error occurred as \fI<curl/curl.h>\fP defines. See the \fIlibcurl-errors(3)\fP
  886. man page for the full list with descriptions.
  887. .SH "SEE ALSO"
  888. .BR curl_easy_init "(3), " curl_easy_cleanup "(3), "