curl_easy_setopt.3 83 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2008, Daniel Stenberg, <[email protected]>, 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$
  22. .\" **************************************************************************
  23. .\"
  24. .TH curl_easy_setopt 3 "30 Jul 2008" "libcurl 7.19.0" "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 \fBlong\fP, a \fBfunction pointer\fP,
  35. an \fBobject pointer\fP or a \fBcurl_off_t\fP, depending on what the specific
  36. option expects. Read this manual carefully as bad input values may cause
  37. libcurl to behave badly! You can only set one option in each function call. A
  38. typical application uses many 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. You can optionally reset all
  43. options back to internal default with \fIcurl_easy_reset(3)\fP.
  44. Strings passed to libcurl as 'char *' arguments, are copied by the library;
  45. thus the string storage associated to the pointer argument may be overwritten
  46. after curl_easy_setopt() returns. Exceptions to this rule are described in
  47. the option details below.
  48. NOTE: before 7.17.0 strings were not copied. Instead the user was forced keep
  49. them available until libcurl no longer needed them.
  50. The \fIhandle\fP is the return code from a \fIcurl_easy_init(3)\fP or
  51. \fIcurl_easy_duphandle(3)\fP call.
  52. .SH BEHAVIOR OPTIONS
  53. .IP CURLOPT_VERBOSE
  54. Set the parameter to 1 to get the library to display a lot of verbose
  55. information about its operations. Very useful for libcurl and/or protocol
  56. debugging and understanding. The verbose information will be sent to stderr,
  57. or the stream set with \fICURLOPT_STDERR\fP.
  58. You hardly ever want this set in production use, you will almost always want
  59. this when you debug/report problems. Another neat option for debugging is the
  60. \fICURLOPT_DEBUGFUNCTION\fP.
  61. .IP CURLOPT_HEADER
  62. A parameter set to 1 tells the library to include the header in the body
  63. output. This is only relevant for protocols that actually have headers
  64. preceding the data (like HTTP).
  65. .IP CURLOPT_NOPROGRESS
  66. A parameter set to 1 tells the library to shut off the built-in progress meter
  67. completely.
  68. Future versions of libcurl is likely to not have any built-in progress meter
  69. at all.
  70. .IP CURLOPT_NOSIGNAL
  71. Pass a long. If it is 1, libcurl will not use any functions that
  72. install signal handlers or any functions that cause signals to be sent to the
  73. process. This option is mainly here to allow multi-threaded unix applications
  74. to still set/use all timeout options etc, without risking getting signals.
  75. (Added in 7.10)
  76. Consider building libcurl with ares support to enable asynchronous DNS
  77. lookups. It enables nice timeouts for name resolves without signals.
  78. .PP
  79. .SH CALLBACK OPTIONS
  80. .IP CURLOPT_WRITEFUNCTION
  81. Function pointer that should match the following prototype: \fBsize_t
  82. function( void *ptr, size_t size, size_t nmemb, void *stream);\fP This
  83. function gets called by libcurl as soon as there is data received that needs
  84. to be saved. The size of the data pointed to by \fIptr\fP is \fIsize\fP
  85. multiplied with \fInmemb\fP, it will not be zero terminated. Return the number
  86. of bytes actually taken care of. If that amount differs from the amount passed
  87. to your function, it'll signal an error to the library and it will abort the
  88. transfer and return \fICURLE_WRITE_ERROR\fP.
  89. From 7.18.0, the function can return CURL_WRITEFUNC_PAUSE which then will
  90. cause writing to this connection to become paused. See
  91. \fIcurl_easy_pause(3)\fP for further details.
  92. This function may be called with zero bytes data if the transfered file is
  93. empty.
  94. Set this option to NULL to get the internal default function. The internal
  95. default function will write the data to the FILE * given with
  96. \fICURLOPT_WRITEDATA\fP.
  97. Set the \fIstream\fP argument with the \fICURLOPT_WRITEDATA\fP option.
  98. The callback function will be passed as much data as possible in all invokes,
  99. but you cannot possibly make any assumptions. It may be one byte, it may be
  100. thousands. The maximum amount of data that can be passed to the write callback
  101. is defined in the curl.h header file: CURL_MAX_WRITE_SIZE.
  102. .IP CURLOPT_WRITEDATA
  103. Data pointer to pass to the file write function. If you use the
  104. \fICURLOPT_WRITEFUNCTION\fP option, this is the pointer you'll get as
  105. input. If you don't use a callback, you must pass a 'FILE *' as libcurl will
  106. pass this to fwrite() when writing data.
  107. The internal \fICURLOPT_WRITEFUNCTION\fP will write the data to the FILE *
  108. given with this option, or to stdout if this option hasn't been set.
  109. If you're using libcurl as a win32 DLL, you \fBMUST\fP use the
  110. \fICURLOPT_WRITEFUNCTION\fP if you set this option or you will experience
  111. crashes.
  112. This option is also known with the older name \fICURLOPT_FILE\fP, the name
  113. \fICURLOPT_WRITEDATA\fP was introduced in 7.9.7.
  114. .IP CURLOPT_READFUNCTION
  115. Function pointer that should match the following prototype: \fBsize_t
  116. function( void *ptr, size_t size, size_t nmemb, void *stream);\fP This
  117. function gets called by libcurl as soon as it needs to read data in order to
  118. send it to the peer. The data area pointed at by the pointer \fIptr\fP may be
  119. filled with at most \fIsize\fP multiplied with \fInmemb\fP number of
  120. bytes. Your function must return the actual number of bytes that you stored in
  121. that memory area. Returning 0 will signal end-of-file to the library and cause
  122. it to stop the current transfer.
  123. If you stop the current transfer by returning 0 "pre-maturely" (i.e before the
  124. server expected it, like when you've told you will upload N bytes and you
  125. upload less than N bytes), you may experience that the server "hangs" waiting
  126. for the rest of the data that won't come.
  127. The read callback may return \fICURL_READFUNC_ABORT\fP to stop the current
  128. operation immediately, resulting in a \fICURLE_ABORTED_BY_CALLBACK\fP error
  129. code from the transfer (Added in 7.12.1)
  130. From 7.18.0, the function can return CURL_READFUNC_PAUSE which then will cause
  131. reading from this connection to become paused. See \fIcurl_easy_pause(3)\fP
  132. for further details.
  133. If you set the callback pointer to NULL, or doesn't set it at all, the default
  134. internal read function will be used. It is simply doing an fread() on the FILE
  135. * stream set with \fICURLOPT_READDATA\fP.
  136. .IP CURLOPT_READDATA
  137. Data pointer to pass to the file read function. If you use the
  138. \fICURLOPT_READFUNCTION\fP option, this is the pointer you'll get as input. If
  139. you don't specify a read callback but instead rely on the default internal
  140. read function, this data must be a valid readable FILE *.
  141. If you're using libcurl as a win32 DLL, you MUST use a
  142. \fICURLOPT_READFUNCTION\fP if you set this option.
  143. This option is also known with the older name \fICURLOPT_INFILE\fP, the name
  144. \fICURLOPT_READDATA\fP was introduced in 7.9.7.
  145. .IP CURLOPT_IOCTLFUNCTION
  146. Function pointer that should match the \fIcurl_ioctl_callback\fP prototype
  147. found in \fI<curl/curl.h>\fP. This function gets called by libcurl when
  148. something special I/O-related needs to be done that the library can't do by
  149. itself. For now, rewinding the read data stream is the only action it can
  150. request. The rewinding of the read data stream may be necessary when doing a
  151. HTTP PUT or POST with a multi-pass authentication method. (Option added in
  152. 7.12.3).
  153. Use \fICURLOPT_SEEKFUNCTION\fP instead to provide seeking!
  154. .IP CURLOPT_IOCTLDATA
  155. Pass a pointer that will be untouched by libcurl and passed as the 3rd
  156. argument in the ioctl callback set with \fICURLOPT_IOCTLFUNCTION\fP. (Option
  157. added in 7.12.3)
  158. .IP CURLOPT_SEEKFUNCTION
  159. Function pointer that should match the following prototype: \fIint
  160. function(void *instream, curl_off_t offset, int origin);\fP This function gets
  161. called by libcurl to seek to a certain position in the input stream and can be
  162. used to fast forward a file in a resumed upload (instead of reading all
  163. uploaded bytes with the normal read function/callback). It is also called to
  164. rewind a stream when doing a HTTP PUT or POST with a multi-pass authentication
  165. method. The function shall work like "fseek" or "lseek" and accepted SEEK_SET,
  166. SEEK_CUR and SEEK_END as argument for origin, although (in 7.18.0) libcurl
  167. only passes SEEK_SET. The callback must return 0 on success as returning
  168. something else will cause the upload operation to fail.
  169. If you forward the input arguments directly to "fseek" or "lseek", note that
  170. the data type for \fIoffset\fP is not the same as defined for curl_off_t on
  171. many systems! (Option added in 7.18.0)
  172. .IP CURLOPT_SEEKDATA
  173. Data pointer to pass to the file read function. If you use the
  174. \fICURLOPT_SEEKFUNCTION\fP option, this is the pointer you'll get as input. If
  175. you don't specify a seek callback, NULL is passed. (Option added in 7.18.0)
  176. .IP CURLOPT_SOCKOPTFUNCTION
  177. Function pointer that should match the \fIcurl_sockopt_callback\fP prototype
  178. found in \fI<curl/curl.h>\fP. This function gets called by libcurl after the
  179. socket() call but before the connect() call. The callback's \fIpurpose\fP
  180. argument identifies the exact purpose for this particular socket, and
  181. currently only one value is supported: \fICURLSOCKTYPE_IPCXN\fP for the
  182. primary connection (meaning the control connection in the FTP case). Future
  183. versions of libcurl may support more purposes. It passes the newly created
  184. socket descriptor so additional setsockopt() calls can be done at the user's
  185. discretion. A non-zero return code from the callback function will signal an
  186. unrecoverable error to the library and it will close the socket and return
  187. \fICURLE_COULDNT_CONNECT\fP. (Option added in 7.15.6.)
  188. .IP CURLOPT_SOCKOPTDATA
  189. Pass a pointer that will be untouched by libcurl and passed as the first
  190. argument in the sockopt callback set with \fICURLOPT_SOCKOPTFUNCTION\fP.
  191. (Option added in 7.15.6.)
  192. .IP CURLOPT_OPENSOCKETFUNCTION
  193. Function pointer that should match the \fIcurl_opensocket_callback\fP
  194. prototype found in \fI<curl/curl.h>\fP. This function gets called by libcurl
  195. instead of the \fIsocket(2)\fP call. The callback's \fIpurpose\fP argument
  196. identifies the exact purpose for this particular socket, and currently only
  197. one value is supported: \fICURLSOCKTYPE_IPCXN\fP for the primary connection
  198. (meaning the control connection in the FTP case). Future versions of libcurl
  199. may support more purposes. It passes the resolved peer address as a
  200. \fIaddress\fP argument so the callback can modify the address or refuse to
  201. connect at all. The callback function should return the socket or
  202. \fICURL_SOCKET_BAD\fP in case no connection should be established or any error
  203. detected. Any additional \fIsetsockopt(2)\fP calls can be done on the socket
  204. at the user's discretion. \fICURL_SOCKET_BAD\fP return value from the
  205. callback function will signal an unrecoverable error to the library and it
  206. will return \fICURLE_COULDNT_CONNECT\fP. This return code can be used for IP
  207. address blacklisting. The default behavior is:
  208. .Bd -literal -offset indent
  209. return socket(addr->family, addr->socktype, addr->protocol);
  210. .Ed
  211. (Option added in 7.17.1.)
  212. .IP CURLOPT_OPENSOCKETDATA
  213. Pass a pointer that will be untouched by libcurl and passed as the first
  214. argument in the opensocket callback set with \fICURLOPT_OPENSOCKETFUNCTION\fP.
  215. (Option added in 7.17.1.)
  216. .IP CURLOPT_PROGRESSFUNCTION
  217. Function pointer that should match the \fIcurl_progress_callback\fP prototype
  218. found in \fI<curl/curl.h>\fP. This function gets called by libcurl instead of
  219. its internal equivalent with a frequent interval during operation (roughly
  220. once per second) no matter if data is being transfered or not. Unknown/unused
  221. argument values passed to the callback will be set to zero (like if you only
  222. download data, the upload size will remain 0). Returning a non-zero value from
  223. this callback will cause libcurl to abort the transfer and return
  224. \fICURLE_ABORTED_BY_CALLBACK\fP.
  225. If you transfer data with the multi interface, this function will not be
  226. called during periods of idleness unless you call the appropriate libcurl
  227. function that performs transfers.
  228. \fICURLOPT_NOPROGRESS\fP must be set to 0 to make this function actually
  229. get called.
  230. .IP CURLOPT_PROGRESSDATA
  231. Pass a pointer that will be untouched by libcurl and passed as the first
  232. argument in the progress callback set with \fICURLOPT_PROGRESSFUNCTION\fP.
  233. .IP CURLOPT_HEADERFUNCTION
  234. Function pointer that should match the following prototype: \fIsize_t
  235. function( void *ptr, size_t size, size_t nmemb, void *stream);\fP. This
  236. function gets called by libcurl as soon as it has received header data. The
  237. header callback will be called once for each header and only complete header
  238. lines are passed on to the callback. Parsing headers should be easy enough
  239. using this. The size of the data pointed to by \fIptr\fP is \fIsize\fP
  240. multiplied with \fInmemb\fP. Do not assume that the header line is zero
  241. terminated! The pointer named \fIstream\fP is the one you set with the
  242. \fICURLOPT_WRITEHEADER\fP option. The callback function must return the number
  243. of bytes actually taken care of, or return -1 to signal error to the library
  244. (it will cause it to abort the transfer with a \fICURLE_WRITE_ERROR\fP return
  245. code).
  246. If this option is not set, or if it is set to NULL, but
  247. \fICURLOPT_HEADERDATA\fP (\fICURLOPT_WRITEHEADER\fP) is set to anything but
  248. NULL, the function used to accept response data will be used instead. That is,
  249. it will be the function specified with \fICURLOPT_WRITEFUNCTION\fP, or if it
  250. is not specified or NULL - the default, stream-writing function.
  251. Since 7.14.1: When a server sends a chunked encoded transfer, it may contain a
  252. trailer. That trailer is identical to a HTTP header and if such a trailer is
  253. received it is passed to the application using this callback as well. There
  254. are several ways to detect it being a trailer and not an ordinary header: 1)
  255. it comes after the response-body. 2) it comes after the final header line (CR
  256. LF) 3) a Trailer: header among the response-headers mention what header to
  257. expect in the trailer.
  258. .IP CURLOPT_WRITEHEADER
  259. (This option is also known as \fBCURLOPT_HEADERDATA\fP) Pass a pointer to be
  260. used to write the header part of the received data to. If you don't use your
  261. own callback to take care of the writing, this must be a valid FILE *. See
  262. also the \fICURLOPT_HEADERFUNCTION\fP option above on how to set a custom
  263. get-all-headers callback.
  264. .IP CURLOPT_DEBUGFUNCTION
  265. Function pointer that should match the following prototype: \fIint
  266. curl_debug_callback (CURL *, curl_infotype, char *, size_t, void *);\fP
  267. \fICURLOPT_DEBUGFUNCTION\fP replaces the standard debug function used when
  268. \fICURLOPT_VERBOSE \fP is in effect. This callback receives debug information,
  269. as specified with the \fBcurl_infotype\fP argument. This function must return
  270. 0. The data pointed to by the char * passed to this function WILL NOT be zero
  271. terminated, but will be exactly of the size as told by the size_t argument.
  272. Available curl_infotype values:
  273. .RS
  274. .IP CURLINFO_TEXT
  275. The data is informational text.
  276. .IP CURLINFO_HEADER_IN
  277. The data is header (or header-like) data received from the peer.
  278. .IP CURLINFO_HEADER_OUT
  279. The data is header (or header-like) data sent to the peer.
  280. .IP CURLINFO_DATA_IN
  281. The data is protocol data received from the peer.
  282. .IP CURLINFO_DATA_OUT
  283. The data is protocol data sent to the peer.
  284. .RE
  285. .IP CURLOPT_DEBUGDATA
  286. Pass a pointer to whatever you want passed in to your
  287. \fICURLOPT_DEBUGFUNCTION\fP in the last void * argument. This pointer is not
  288. used by libcurl, it is only passed to the callback.
  289. .IP CURLOPT_SSL_CTX_FUNCTION
  290. This option does only function for libcurl powered by OpenSSL. If libcurl was
  291. built against another SSL library, this functionality is absent.
  292. Function pointer that should match the following prototype: \fBCURLcode
  293. sslctxfun(CURL *curl, void *sslctx, void *parm);\fP This function gets called
  294. by libcurl just before the initialization of an SSL connection after having
  295. processed all other SSL related options to give a last chance to an
  296. application to modify the behaviour of openssl's ssl initialization. The
  297. \fIsslctx\fP parameter is actually a pointer to an openssl \fISSL_CTX\fP. If
  298. an error is returned no attempt to establish a connection is made and the
  299. perform operation will return the error code from this callback function. Set
  300. the \fIparm\fP argument with the \fICURLOPT_SSL_CTX_DATA\fP option. This
  301. option was introduced in 7.11.0.
  302. This function will get called on all new connections made to a server, during
  303. the SSL negotiation. The SSL_CTX pointer will be a new one every time.
  304. To use this properly, a non-trivial amount of knowledge of the openssl
  305. libraries is necessary. Using this function allows for example to use openssl
  306. callbacks to add additional validation code for certificates, and even to
  307. change the actual URI of an HTTPS request (example used in the lib509 test
  308. case). See also the example section for a replacement of the key, certificate
  309. and trust file settings.
  310. .IP CURLOPT_SSL_CTX_DATA
  311. Data pointer to pass to the ssl context callback set by the option
  312. \fICURLOPT_SSL_CTX_FUNCTION\fP, this is the pointer you'll get as third
  313. parameter, otherwise \fBNULL\fP. (Added in 7.11.0)
  314. .IP CURLOPT_CONV_TO_NETWORK_FUNCTION
  315. .IP CURLOPT_CONV_FROM_NETWORK_FUNCTION
  316. .IP CURLOPT_CONV_FROM_UTF8_FUNCTION
  317. Function pointers that should match the following prototype: CURLcode
  318. function(char *ptr, size_t length);
  319. These three options apply to non-ASCII platforms only. They are available
  320. only if \fBCURL_DOES_CONVERSIONS\fP was defined when libcurl was built. When
  321. this is the case, \fIcurl_version_info(3)\fP will return the CURL_VERSION_CONV
  322. feature bit set.
  323. The data to be converted is in a buffer pointed to by the ptr parameter. The
  324. amount of data to convert is indicated by the length parameter. The converted
  325. data overlays the input data in the buffer pointed to by the ptr parameter.
  326. CURLE_OK should be returned upon successful conversion. A CURLcode return
  327. value defined by curl.h, such as CURLE_CONV_FAILED, should be returned if an
  328. error was encountered.
  329. \fBCURLOPT_CONV_TO_NETWORK_FUNCTION\fP and
  330. \fBCURLOPT_CONV_FROM_NETWORK_FUNCTION\fP convert between the host encoding and
  331. the network encoding. They are used when commands or ASCII data are
  332. sent/received over the network.
  333. \fBCURLOPT_CONV_FROM_UTF8_FUNCTION\fP is called to convert from UTF8 into the
  334. host encoding. It is required only for SSL processing.
  335. If you set a callback pointer to NULL, or don't set it at all, the built-in
  336. libcurl iconv functions will be used. If HAVE_ICONV was not defined when
  337. libcurl was built, and no callback has been established, conversion will
  338. return the CURLE_CONV_REQD error code.
  339. If HAVE_ICONV is defined, CURL_ICONV_CODESET_OF_HOST must also be defined.
  340. For example:
  341. \&#define CURL_ICONV_CODESET_OF_HOST "IBM-1047"
  342. The iconv code in libcurl will default the network and UTF8 codeset names as
  343. follows:
  344. \&#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1"
  345. \&#define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8"
  346. You will need to override these definitions if they are different on your
  347. system.
  348. .SH ERROR OPTIONS
  349. .IP CURLOPT_ERRORBUFFER
  350. Pass a char * to a buffer that the libcurl may store human readable error
  351. messages in. This may be more helpful than just the return code from
  352. \fIcurl_easy_perform\fP. The buffer must be at least CURL_ERROR_SIZE big.
  353. Although this argument is a 'char *', it does not describe an input string.
  354. Therefore the (probably undefined) contents of the buffer is NOT copied
  355. by the library. You should keep the associated storage available until
  356. libcurl no longer needs it. Failing to do so will cause very odd behavior
  357. or even crashes. libcurl will need it until you call \fIcurl_easy_cleanup(3)\fP
  358. or you set the same option again to use a different pointer.
  359. Use \fICURLOPT_VERBOSE\fP and \fICURLOPT_DEBUGFUNCTION\fP to better
  360. debug/trace why errors happen.
  361. If the library does not return an error, the buffer may not have been
  362. touched. Do not rely on the contents in those cases.
  363. .IP CURLOPT_STDERR
  364. Pass a FILE * as parameter. Tell libcurl to use this stream instead of stderr
  365. when showing the progress meter and displaying \fICURLOPT_VERBOSE\fP data.
  366. .IP CURLOPT_FAILONERROR
  367. A parameter set to 1 tells the library to fail silently if the HTTP code
  368. returned is equal to or larger than 400. The default action would be to return
  369. the page normally, ignoring that code.
  370. This method is not fail-safe and there are occasions where non-successful
  371. response codes will slip through, especially when authentication is involved
  372. (response codes 401 and 407).
  373. You might get some amounts of headers transferred before this situation is
  374. detected, like for when a "100-continue" is received as a response to a
  375. POST/PUT and a 401 or 407 is received immediately afterwards.
  376. .SH NETWORK OPTIONS
  377. .IP CURLOPT_URL
  378. The actual URL to deal with. The parameter should be a char * to a zero
  379. terminated string.
  380. If the given URL lacks the protocol part ("http://" or "ftp://" etc), it will
  381. attempt to guess which protocol to use based on the given host name. If the
  382. given protocol of the set URL is not supported, libcurl will return on error
  383. (\fICURLE_UNSUPPORTED_PROTOCOL\fP) when you call \fIcurl_easy_perform(3)\fP or
  384. \fIcurl_multi_perform(3)\fP. Use \fIcurl_version_info(3)\fP for detailed info
  385. on which protocols that are supported.
  386. The string given to CURLOPT_URL must be url-encoded and following the RFC 2396
  387. (http://curl.haxx.se/rfc/rfc2396.txt).
  388. \fICURLOPT_URL\fP is the only option that \fBmust\fP be set before
  389. \fIcurl_easy_perform(3)\fP is called.
  390. .IP CURLOPT_PROXY
  391. Set HTTP proxy to use. The parameter should be a char * to a zero terminated
  392. string holding the host name or dotted IP address. To specify port number in
  393. this string, append :[port] to the end of the host name. The proxy string may
  394. be prefixed with [protocol]:// since any such prefix will be ignored. The
  395. proxy's port number may optionally be specified with the separate option
  396. \fICURLOPT_PROXYPORT\fP.
  397. When you tell the library to use an HTTP proxy, libcurl will transparently
  398. convert operations to HTTP even if you specify an FTP URL etc. This may have
  399. an impact on what other features of the library you can use, such as
  400. \fICURLOPT_QUOTE\fP and similar FTP specifics that don't work unless you
  401. tunnel through the HTTP proxy. Such tunneling is activated with
  402. \fICURLOPT_HTTPPROXYTUNNEL\fP.
  403. libcurl respects the environment variables \fBhttp_proxy\fP, \fBftp_proxy\fP,
  404. \fBall_proxy\fP etc, if any of those is set. The \fICURLOPT_PROXY\fP option
  405. does however override any possibly set environment variables.
  406. Setting the proxy string to "" (an empty string) will explicitly disable the
  407. use of a proxy, even if there is an environment variable set for it.
  408. Since 7.14.1, the proxy host string given in environment variables can be
  409. specified the exact same way as the proxy can be set with \fICURLOPT_PROXY\fP,
  410. include protocol prefix (http://) and embedded user + password.
  411. .IP CURLOPT_PROXYPORT
  412. Pass a long with this option to set the proxy port to connect to unless it is
  413. specified in the proxy string \fICURLOPT_PROXY\fP.
  414. .IP CURLOPT_PROXYTYPE
  415. Pass a long with this option to set type of the proxy. Available options for
  416. this are \fICURLPROXY_HTTP\fP, \fICURLPROXY_SOCKS4\fP (added in 7.15.2),
  417. \fICURLPROXY_SOCKS5\fP, \fICURLPROXY_SOCKS4A\fP (added in 7.18.0) and
  418. \fICURLPROXY_SOCKS5_HOSTNAME\fP (added in 7.18.0). The HTTP type is
  419. default. (Added in 7.10)
  420. .IP CURLOPT_HTTPPROXYTUNNEL
  421. Set the parameter to 1 to make the library tunnel all operations through a
  422. given HTTP proxy. There is a big difference between using a proxy and to
  423. tunnel through it. If you don't know what this means, you probably don't want
  424. this tunneling option.
  425. .IP CURLOPT_SOCKS5_RESOLVE_LOCAL
  426. Set the parameter to 1 to make the library to resolve the host name locally
  427. instead of passing it to the proxy to resolve, when using a SOCKS5 proxy.
  428. Note that libcurl before 7.18.0 always resolved the host name locally even
  429. when SOCKS5 was used. (Added in 7.18.0)
  430. .IP CURLOPT_INTERFACE
  431. Pass a char * as parameter. This set the interface name to use as outgoing
  432. network interface. The name can be an interface name, an IP address or a host
  433. name.
  434. .IP CURLOPT_LOCALPORT
  435. Pass a long. This sets the local port number of the socket used for
  436. connection. This can be used in combination with \fICURLOPT_INTERFACE\fP and
  437. you are recommended to use \fICURLOPT_LOCALPORTRANGE\fP as well when this is
  438. set. Note that port numbers are only valid 1 - 65535. (Added in 7.15.2)
  439. .IP CURLOPT_LOCALPORTRANGE
  440. Pass a long. This is the number of attempts libcurl should do to find a
  441. working local port number. It starts with the given \fICURLOPT_LOCALPORT\fP
  442. and adds one to the number for each retry. Setting this to 1 or below will
  443. make libcurl do only one try for the exact port number. Note that port numbers
  444. by nature are scarce resources that will be busy at times so setting this
  445. value to something too low might cause unnecessary connection setup
  446. failures. (Added in 7.15.2)
  447. .IP CURLOPT_DNS_CACHE_TIMEOUT
  448. Pass a long, this sets the timeout in seconds. Name resolves will be kept in
  449. memory for this number of seconds. Set to zero to completely disable
  450. caching, or set to -1 to make the cached entries remain forever. By default,
  451. libcurl caches this info for 60 seconds.
  452. NOTE: the name resolve functions of various libc implementations don't re-read
  453. name server information unless explicitly told so (by for example calling
  454. \fIres_init(3)\fP. This may cause libcurl to keep using the older server even
  455. if DHCP has updated the server info, and this may look like a DNS cache issue
  456. to the casual libcurl-app user.
  457. .IP CURLOPT_DNS_USE_GLOBAL_CACHE
  458. Pass a long. If the value is 1, it tells curl to use a global DNS cache
  459. that will survive between easy handle creations and deletions. This is not
  460. thread-safe and this will use a global variable.
  461. \fBWARNING:\fP this option is considered obsolete. Stop using it. Switch over
  462. to using the share interface instead! See \fICURLOPT_SHARE\fP and
  463. \fIcurl_share_init(3)\fP.
  464. .IP CURLOPT_BUFFERSIZE
  465. Pass a long specifying your preferred size (in bytes) for the receive buffer
  466. in libcurl. The main point of this would be that the write callback gets
  467. called more often and with smaller chunks. This is just treated as a request,
  468. not an order. You cannot be guaranteed to actually get the given size. (Added
  469. in 7.10)
  470. This size is by default set as big as possible (CURL_MAX_WRITE_SIZE), so it
  471. only makes sense to use this option if you want it smaller.
  472. .IP CURLOPT_PORT
  473. Pass a long specifying what remote port number to connect to, instead of the
  474. one specified in the URL or the default port for the used protocol.
  475. .IP CURLOPT_TCP_NODELAY
  476. Pass a long specifying whether the TCP_NODELAY option should be set or
  477. cleared (1 = set, 0 = clear). The option is cleared by default. This
  478. will have no effect after the connection has been established.
  479. Setting this option will disable TCP's Nagle algorithm. The purpose of
  480. this algorithm is to try to minimize the number of small packets on
  481. the network (where "small packets" means TCP segments less than the
  482. Maximum Segment Size (MSS) for the network).
  483. Maximizing the amount of data sent per TCP segment is good because it
  484. amortizes the overhead of the send. However, in some cases (most
  485. notably telnet or rlogin) small segments may need to be sent
  486. without delay. This is less efficient than sending larger amounts of
  487. data at a time, and can contribute to congestion on the network if
  488. overdone.
  489. .IP CURLOPT_ADDRESS_SCOPE
  490. Pass a long specifying the scope_id value to use when connecting to IPv6
  491. link-local or site-local addresses.
  492. .SH NAMES and PASSWORDS OPTIONS (Authentication)
  493. .IP CURLOPT_NETRC
  494. This parameter controls the preference of libcurl between using user names and
  495. passwords from your \fI~/.netrc\fP file, relative to user names and passwords
  496. in the URL supplied with \fICURLOPT_URL\fP.
  497. libcurl uses a user name (and supplied or prompted password) supplied with
  498. \fICURLOPT_USERPWD\fP in preference to any of the options controlled by this
  499. parameter.
  500. Pass a long, set to one of the values described below.
  501. .RS
  502. .IP CURL_NETRC_OPTIONAL
  503. The use of your \fI~/.netrc\fP file is optional, and information in the URL is
  504. to be preferred. The file will be scanned with the host and user name (to
  505. find the password only) or with the host only, to find the first user name and
  506. password after that \fImachine\fP, which ever information is not specified in
  507. the URL.
  508. Undefined values of the option will have this effect.
  509. .IP CURL_NETRC_IGNORED
  510. The library will ignore the file and use only the information in the URL.
  511. This is the default.
  512. .IP CURL_NETRC_REQUIRED
  513. This value tells the library that use of the file is required, to ignore the
  514. information in the URL, and to search the file with the host only.
  515. .RE
  516. Only machine name, user name and password are taken into account
  517. (init macros and similar things aren't supported).
  518. libcurl does not verify that the file has the correct properties set (as the
  519. standard Unix ftp client does). It should only be readable by user.
  520. .IP CURLOPT_NETRC_FILE
  521. Pass a char * as parameter, pointing to a zero terminated string containing
  522. the full path name to the file you want libcurl to use as .netrc file. If this
  523. option is omitted, and \fICURLOPT_NETRC\fP is set, libcurl will attempt to
  524. find a .netrc file in the current user's home directory. (Added in 7.10.9)
  525. .IP CURLOPT_USERPWD
  526. Pass a char * as parameter, which should be [user name]:[password] to use for
  527. the connection. Use \fICURLOPT_HTTPAUTH\fP to decide authentication method.
  528. When using NTLM, you can set domain by prepending it to the user name and
  529. separating the domain and name with a forward (/) or backward slash (\\). Like
  530. this: "domain/user:password" or "domain\\user:password". Some HTTP servers (on
  531. Windows) support this style even for Basic authentication.
  532. When using HTTP and \fICURLOPT_FOLLOWLOCATION\fP, libcurl might perform
  533. several requests to possibly different hosts. libcurl will only send this user
  534. and password information to hosts using the initial host name (unless
  535. \fICURLOPT_UNRESTRICTED_AUTH\fP is set), so if libcurl follows locations to
  536. other hosts it will not send the user and password to those. This is enforced
  537. to prevent accidental information leakage.
  538. .IP CURLOPT_PROXYUSERPWD
  539. Pass a char * as parameter, which should be [user name]:[password] to use for
  540. the connection to the HTTP proxy. Use \fICURLOPT_PROXYAUTH\fP to decide
  541. authentication method.
  542. .IP CURLOPT_HTTPAUTH
  543. Pass a long as parameter, which is set to a bitmask, to tell libcurl what
  544. authentication method(s) you want it to use. The available bits are listed
  545. below. If more than one bit is set, libcurl will first query the site to see
  546. what authentication methods it supports and then pick the best one you allow
  547. it to use. For some methods, this will induce an extra network round-trip. Set
  548. the actual name and password with the \fICURLOPT_USERPWD\fP option. (Added in
  549. 7.10.6)
  550. .RS
  551. .IP CURLAUTH_BASIC
  552. HTTP Basic authentication. This is the default choice, and the only method
  553. that is in wide-spread use and supported virtually everywhere. This is sending
  554. the user name and password over the network in plain text, easily captured by
  555. others.
  556. .IP CURLAUTH_DIGEST
  557. HTTP Digest authentication. Digest authentication is defined in RFC2617 and
  558. is a more secure way to do authentication over public networks than the
  559. regular old-fashioned Basic method.
  560. .IP CURLAUTH_GSSNEGOTIATE
  561. HTTP GSS-Negotiate authentication. The GSS-Negotiate (also known as plain
  562. \&"Negotiate") method was designed by Microsoft and is used in their web
  563. applications. It is primarily meant as a support for Kerberos5 authentication
  564. but may be also used along with another authentication methods. For more
  565. information see IETF draft draft-brezak-spnego-http-04.txt.
  566. You need to build libcurl with a suitable GSS-API library for this to work.
  567. .IP CURLAUTH_NTLM
  568. HTTP NTLM authentication. A proprietary protocol invented and used by
  569. Microsoft. It uses a challenge-response and hash concept similar to Digest, to
  570. prevent the password from being eavesdropped.
  571. You need to build libcurl with OpenSSL support for this option to work, or
  572. build libcurl on Windows.
  573. .IP CURLAUTH_ANY
  574. This is a convenience macro that sets all bits and thus makes libcurl pick any
  575. it finds suitable. libcurl will automatically select the one it finds most
  576. secure.
  577. .IP CURLAUTH_ANYSAFE
  578. This is a convenience macro that sets all bits except Basic and thus makes
  579. libcurl pick any it finds suitable. libcurl will automatically select the one it
  580. finds most secure.
  581. .RE
  582. .IP CURLOPT_PROXYAUTH
  583. Pass a long as parameter, which is set to a bitmask, to tell libcurl what
  584. authentication method(s) you want it to use for your proxy authentication. If
  585. more than one bit is set, libcurl will first query the site to see what
  586. authentication methods it supports and then pick the best one you allow it to
  587. use. For some methods, this will induce an extra network round-trip. Set the
  588. actual name and password with the \fICURLOPT_PROXYUSERPWD\fP option. The
  589. bitmask can be constructed by or'ing together the bits listed above for the
  590. \fICURLOPT_HTTPAUTH\fP option. As of this writing, only Basic, Digest and NTLM
  591. work. (Added in 7.10.7)
  592. .SH HTTP OPTIONS
  593. .IP CURLOPT_AUTOREFERER
  594. Pass a parameter set to 1 to enable this. When enabled, libcurl will
  595. automatically set the Referer: field in requests where it follows a Location:
  596. redirect.
  597. .IP CURLOPT_ENCODING
  598. Sets the contents of the Accept-Encoding: header sent in an HTTP request, and
  599. enables decoding of a response when a Content-Encoding: header is received.
  600. Three encodings are supported: \fIidentity\fP, which does nothing,
  601. \fIdeflate\fP which requests the server to compress its response using the
  602. zlib algorithm, and \fIgzip\fP which requests the gzip algorithm. If a
  603. zero-length string is set, then an Accept-Encoding: header containing all
  604. supported encodings is sent.
  605. This is a request, not an order; the server may or may not do it. This option
  606. must be set (to any non-NULL value) or else any unsolicited encoding done by
  607. the server is ignored. See the special file lib/README.encoding for details.
  608. .IP CURLOPT_FOLLOWLOCATION
  609. A parameter set to 1 tells the library to follow any Location: header that the
  610. server sends as part of an HTTP header.
  611. This means that the library will re-send the same request on the new location
  612. and follow new Location: headers all the way until no more such headers are
  613. returned. \fICURLOPT_MAXREDIRS\fP can be used to limit the number of redirects
  614. libcurl will follow.
  615. .IP CURLOPT_UNRESTRICTED_AUTH
  616. A parameter set to 1 tells the library it can continue to send authentication
  617. (user+password) when following locations, even when hostname changed. This
  618. option is meaningful only when setting \fICURLOPT_FOLLOWLOCATION\fP.
  619. .IP CURLOPT_MAXREDIRS
  620. Pass a long. The set number will be the redirection limit. If that many
  621. redirections have been followed, the next redirect will cause an error
  622. (\fICURLE_TOO_MANY_REDIRECTS\fP). This option only makes sense if the
  623. \fICURLOPT_FOLLOWLOCATION\fP is used at the same time. Added in 7.15.1:
  624. Setting the limit to 0 will make libcurl refuse any redirect. Set it to -1 for
  625. an infinite number of redirects (which is the default)
  626. .IP CURLOPT_POST301
  627. A parameter set to 1 tells the library to respect RFC 2616/10.3.2 and not
  628. convert POST requests into GET requests when following a 301 redirection. The
  629. non-RFC behaviour is ubiquitous in web browsers, so the library does the
  630. conversion by default to maintain consistency. However, a server may requires
  631. a POST to remain a POST after such a redirection. This option is meaningful
  632. only when setting \fICURLOPT_FOLLOWLOCATION\fP. (Added in 7.17.1)
  633. .IP CURLOPT_PUT
  634. A parameter set to 1 tells the library to use HTTP PUT to transfer data. The
  635. data should be set with \fICURLOPT_READDATA\fP and \fICURLOPT_INFILESIZE\fP.
  636. This option is deprecated and starting with version 7.12.1 you should instead
  637. use \fICURLOPT_UPLOAD\fP.
  638. .IP CURLOPT_POST
  639. A parameter set to 1 tells the library to do a regular HTTP post. This will
  640. also make the library use a "Content-Type:
  641. application/x-www-form-urlencoded" header. (This is by far the most commonly
  642. used POST method).
  643. Use one of \fICURLOPT_POSTFIELDS\fP or \fICURLOPT_COPYPOSTFIELDS\fP options to
  644. specify what data to post and \fICURLOPT_POSTFIELDSIZE\fP or
  645. \fICURLOPT_POSTFIELDSIZE_LARGE\fP to set the data size.
  646. Optionally, you can provide data to POST using the \fICURLOPT_READFUNCTION\fP
  647. and \fICURLOPT_READDATA\fP options but then you must make sure to not set
  648. \fICURLOPT_POSTFIELDS\fP to anything but NULL. When providing data with a
  649. callback, you must transmit it using chunked transfer-encoding or you must set
  650. the size of the data with the \fICURLOPT_POSTFIELDSIZE\fP or
  651. \fICURLOPT_POSTFIELDSIZE_LARGE\fP option. To enable chunked encoding, you
  652. simply pass in the appropriate Transfer-Encoding header, see the
  653. post-callback.c example.
  654. You can override the default POST Content-Type: header by setting your own
  655. with \fICURLOPT_HTTPHEADER\fP.
  656. Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header.
  657. You can disable this header with \fICURLOPT_HTTPHEADER\fP as usual.
  658. If you use POST to a HTTP 1.1 server, you can send data without knowing the
  659. size before starting the POST if you use chunked encoding. You enable this by
  660. adding a header like "Transfer-Encoding: chunked" with
  661. \fICURLOPT_HTTPHEADER\fP. With HTTP 1.0 or without chunked transfer, you must
  662. specify the size in the request.
  663. When setting \fICURLOPT_POST\fP to 1, it will automatically set
  664. \fICURLOPT_NOBODY\fP to 0 (since 7.14.1).
  665. If you issue a POST request and then want to make a HEAD or GET using the same
  666. re-used handle, you must explicitly set the new request type using
  667. \fICURLOPT_NOBODY\fP or \fICURLOPT_HTTPGET\fP or similar.
  668. .IP CURLOPT_POSTFIELDS
  669. Pass a void * as parameter, which should be the full data to post in an HTTP
  670. POST operation. You must make sure that the data is formatted the way you want
  671. the server to receive it. libcurl will not convert or encode it for you. Most
  672. web servers will assume this data to be url-encoded. Take note.
  673. The pointed data are NOT copied by the library: as a consequence, they must
  674. be preserved by the calling application until the transfer finishes.
  675. This POST is a normal application/x-www-form-urlencoded kind (and libcurl will
  676. set that Content-Type by default when this option is used), which is the most
  677. commonly used one by HTML forms. See also the \fICURLOPT_POST\fP. Using
  678. \fICURLOPT_POSTFIELDS\fP implies \fICURLOPT_POST\fP.
  679. If you want to do a zero-byte POST, you need to set
  680. \fICURLOPT_POSTFIELDSIZE\fP explicitly to zero, as simply setting
  681. \fICURLOPT_POSTFIELDS\fP to NULL or "" just effectively disables the sending
  682. of the specified string. libcurl will instead assume that you'll send the POST
  683. data using the read callback!
  684. Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header.
  685. You can disable this header with \fICURLOPT_HTTPHEADER\fP as usual.
  686. To make multipart/formdata posts (aka rfc1867-posts), check out the
  687. \fICURLOPT_HTTPPOST\fP option.
  688. .IP CURLOPT_POSTFIELDSIZE
  689. If you want to post data to the server without letting libcurl do a strlen()
  690. to measure the data size, this option must be used. When this option is used
  691. you can post fully binary data, which otherwise is likely to fail. If this
  692. size is set to -1, the library will use strlen() to get the size.
  693. .IP CURLOPT_POSTFIELDSIZE_LARGE
  694. Pass a curl_off_t as parameter. Use this to set the size of the
  695. \fICURLOPT_POSTFIELDS\fP data to prevent libcurl from doing strlen() on the
  696. data to figure out the size. This is the large file version of the
  697. \fICURLOPT_POSTFIELDSIZE\fP option. (Added in 7.11.1)
  698. .IP CURLOPT_COPYPOSTFIELDS
  699. Pass a char * as parameter, which should be the full data to post in an HTTP
  700. POST operation. It behaves as the \fICURLOPT_POSTFIELDS\fP option, but the
  701. original data are copied by the library, allowing the application to overwrite
  702. the original data after setting this option.
  703. Because data are copied, care must be taken when using this option in
  704. conjunction with \fICURLOPT_POSTFIELDSIZE\fP or
  705. \fICURLOPT_POSTFIELDSIZE_LARGE\fP: If the size has not been set prior to
  706. \fICURLOPT_COPYPOSTFIELDS\fP, the data are assumed to be a NUL-terminated
  707. string; else the stored size informs the library about the data byte count to
  708. copy. In any case, the size must not be changed after
  709. \fICURLOPT_COPYPOSTFIELDS\fP, unless another \fICURLOPT_POSTFIELDS\fP or
  710. \fICURLOPT_COPYPOSTFIELDS\fP option is issued.
  711. (Added in 7.17.1)
  712. .IP CURLOPT_HTTPPOST
  713. Tells libcurl you want a multipart/formdata HTTP POST to be made and you
  714. instruct what data to pass on to the server. Pass a pointer to a linked list
  715. of curl_httppost structs as parameter. . The easiest way to create such a
  716. list, is to use \fIcurl_formadd(3)\fP as documented. The data in this list
  717. must remain intact until you close this curl handle again with
  718. \fIcurl_easy_cleanup(3)\fP.
  719. Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header.
  720. You can disable this header with \fICURLOPT_HTTPHEADER\fP as usual.
  721. When setting \fICURLOPT_HTTPPOST\fP, it will automatically set
  722. \fICURLOPT_NOBODY\fP to 0 (since 7.14.1).
  723. .IP CURLOPT_REFERER
  724. Pass a pointer to a zero terminated string as parameter. It will be used to
  725. set the Referer: header in the http request sent to the remote server. This
  726. can be used to fool servers or scripts. You can also set any custom header
  727. with \fICURLOPT_HTTPHEADER\fP.
  728. .IP CURLOPT_USERAGENT
  729. Pass a pointer to a zero terminated string as parameter. It will be used to
  730. set the User-Agent: header in the http request sent to the remote server. This
  731. can be used to fool servers or scripts. You can also set any custom header
  732. with \fICURLOPT_HTTPHEADER\fP.
  733. .IP CURLOPT_HTTPHEADER
  734. Pass a pointer to a linked list of HTTP headers to pass to the server in your
  735. HTTP request. The linked list should be a fully valid list of \fBstruct
  736. curl_slist\fP structs properly filled in. Use \fIcurl_slist_append(3)\fP to
  737. create the list and \fIcurl_slist_free_all(3)\fP to clean up an entire
  738. list. If you add a header that is otherwise generated and used by libcurl
  739. internally, your added one will be used instead. If you add a header with no
  740. contents as in 'Accept:' (no data on the right side of the colon), the
  741. internally used header will get disabled. Thus, using this option you can add
  742. new headers, replace internal headers and remove internal headers. To add a
  743. header with no contents, make the contents be two quotes: \&"". The headers
  744. included in the linked list must not be CRLF-terminated, because curl adds
  745. CRLF after each header item. Failure to comply with this will result in
  746. strange bugs because the server will most likely ignore part of the headers
  747. you specified.
  748. The first line in a request (containing the method, usually a GET or POST) is
  749. not a header and cannot be replaced using this option. Only the lines
  750. following the request-line are headers. Adding this method line in this list
  751. of headers will only cause your request to send an invalid header.
  752. Pass a NULL to this to reset back to no custom headers.
  753. The most commonly replaced headers have "shortcuts" in the options
  754. \fICURLOPT_COOKIE\fP, \fICURLOPT_USERAGENT\fP and \fICURLOPT_REFERER\fP.
  755. .IP CURLOPT_HTTP200ALIASES
  756. Pass a pointer to a linked list of aliases to be treated as valid HTTP 200
  757. responses. Some servers respond with a custom header response line. For
  758. example, IceCast servers respond with "ICY 200 OK". By including this string
  759. in your list of aliases, the response will be treated as a valid HTTP header
  760. line such as "HTTP/1.0 200 OK". (Added in 7.10.3)
  761. The linked list should be a fully valid list of struct curl_slist structs, and
  762. be properly filled in. Use \fIcurl_slist_append(3)\fP to create the list and
  763. \fIcurl_slist_free_all(3)\fP to clean up an entire list.
  764. The alias itself is not parsed for any version strings. Before libcurl 7.16.3,
  765. Libcurl used the value set by option \fICURLOPT_HTTP_VERSION\fP, but starting
  766. with 7.16.3 the protocol is assumed to match HTTP 1.0 when an alias matched.
  767. .IP CURLOPT_COOKIE
  768. Pass a pointer to a zero terminated string as parameter. It will be used to
  769. set a cookie in the http request. The format of the string should be
  770. NAME=CONTENTS, where NAME is the cookie name and CONTENTS is what the cookie
  771. should contain.
  772. If you need to set multiple cookies, you need to set them all using a single
  773. option and thus you need to concatenate them all in one single string. Set
  774. multiple cookies in one string like this: "name1=content1; name2=content2;"
  775. etc.
  776. Note that this option sets the cookie header explictly in the outgoing
  777. request(s). If multiple requests are done due to authentication, followed
  778. redirections or similar, they will all get this cookie passed on.
  779. Using this option multiple times will only make the latest string override the
  780. previous ones.
  781. .IP CURLOPT_COOKIEFILE
  782. Pass a pointer to a zero terminated string as parameter. It should contain the
  783. name of your file holding cookie data to read. The cookie data may be in
  784. Netscape / Mozilla cookie data format or just regular HTTP-style headers
  785. dumped to a file.
  786. Given an empty or non-existing file or by passing the empty string (""), this
  787. option will enable cookies for this curl handle, making it understand and
  788. parse received cookies and then use matching cookies in future request.
  789. If you use this option multiple times, you just add more files to read.
  790. Subsequent files will add more cookies.
  791. .IP CURLOPT_COOKIEJAR
  792. Pass a file name as char *, zero terminated. This will make libcurl write all
  793. internally known cookies to the specified file when \fIcurl_easy_cleanup(3)\fP
  794. is called. If no cookies are known, no file will be created. Specify "-" to
  795. instead have the cookies written to stdout. Using this option also enables
  796. cookies for this session, so if you for example follow a location it will make
  797. matching cookies get sent accordingly.
  798. If the cookie jar file can't be created or written to (when the
  799. \fIcurl_easy_cleanup(3)\fP is called), libcurl will not and cannot report an
  800. error for this. Using \fICURLOPT_VERBOSE\fP or \fICURLOPT_DEBUGFUNCTION\fP
  801. will get a warning to display, but that is the only visible feedback you get
  802. about this possibly lethal situation.
  803. .IP CURLOPT_COOKIESESSION
  804. Pass a long set to 1 to mark this as a new cookie "session". It will force
  805. libcurl to ignore all cookies it is about to load that are "session cookies"
  806. from the previous session. By default, libcurl always stores and loads all
  807. cookies, independent if they are session cookies are not. Session cookies are
  808. cookies without expiry date and they are meant to be alive and existing for
  809. this "session" only.
  810. .IP CURLOPT_COOKIELIST
  811. Pass a char * to a cookie string. Cookie can be either in Netscape / Mozilla
  812. format or just regular HTTP-style header (Set-Cookie: ...) format. If cURL
  813. cookie engine was not enabled it will enable its cookie engine. Passing a
  814. magic string \&"ALL" will erase all cookies known by cURL. (Added in 7.14.1)
  815. Passing the special string \&"SESS" will only erase all session cookies known
  816. by cURL. (Added in 7.15.4) Passing the special string \&"FLUSH" will write
  817. all cookies known by cURL to the file specified by \fICURLOPT_COOKIEJAR\fP.
  818. (Added in 7.17.1)
  819. .IP CURLOPT_HTTPGET
  820. Pass a long. If the long is 1, this forces the HTTP request to get back
  821. to GET. usable if a POST, HEAD, PUT or a custom request have been used
  822. previously using the same curl handle.
  823. When setting \fICURLOPT_HTTPGET\fP to 1, it will automatically set
  824. \fICURLOPT_NOBODY\fP to 0 (since 7.14.1).
  825. .IP CURLOPT_HTTP_VERSION
  826. Pass a long, set to one of the values described below. They force libcurl to
  827. use the specific HTTP versions. This is not sensible to do unless you have a
  828. good reason.
  829. .RS
  830. .IP CURL_HTTP_VERSION_NONE
  831. We don't care about what version the library uses. libcurl will use whatever
  832. it thinks fit.
  833. .IP CURL_HTTP_VERSION_1_0
  834. Enforce HTTP 1.0 requests.
  835. .IP CURL_HTTP_VERSION_1_1
  836. Enforce HTTP 1.1 requests.
  837. .RE
  838. .IP CURLOPT_IGNORE_CONTENT_LENGTH
  839. Ignore the Content-Length header. This is useful for Apache 1.x (and similar
  840. servers) which will report incorrect content length for files over 2
  841. gigabytes. If this option is used, curl will not be able to accurately report
  842. progress, and will simply stop the download when the server ends the
  843. connection. (added in 7.14.1)
  844. .IP CURLOPT_HTTP_CONTENT_DECODING
  845. Pass a long to tell libcurl how to act on content decoding. If set to zero,
  846. content decoding will be disabled. If set to 1 it is enabled. Note however
  847. that libcurl has no default content decoding but requires you to use
  848. \fICURLOPT_ENCODING\fP for that. (added in 7.16.2)
  849. .IP CURLOPT_HTTP_TRANSFER_DECODING
  850. Pass a long to tell libcurl how to act on transfer decoding. If set to zero,
  851. transfer decoding will be disabled, if set to 1 it is enabled
  852. (default). libcurl does chunked transfer decoding by default unless this
  853. option is set to zero. (added in 7.16.2)
  854. .SH FTP OPTIONS
  855. .IP CURLOPT_FTPPORT
  856. Pass a pointer to a zero terminated string as parameter. It will be used to
  857. get the IP address to use for the ftp PORT instruction. The PORT instruction
  858. tells the remote server to connect to our specified IP address. The string may
  859. be a plain IP address, a host name, an network interface name (under Unix) or
  860. just a '-' letter to let the library use your systems default IP
  861. address. Default FTP operations are passive, and thus won't use PORT.
  862. You disable PORT again and go back to using the passive version by setting
  863. this option to NULL.
  864. .IP CURLOPT_QUOTE
  865. Pass a pointer to a linked list of FTP or SFTP commands to pass to
  866. the server prior to your ftp request. This will be done before any
  867. other commands are issued (even before the CWD command for FTP). The
  868. linked list should be a fully valid list of 'struct curl_slist' structs
  869. properly filled in with text strings. Use \fIcurl_slist_append(3)\fP
  870. to append strings (commands) to the list, and clear the entire list
  871. afterwards with \fIcurl_slist_free_all(3)\fP. Disable this operation
  872. again by setting a NULL to this option.
  873. The set of valid FTP commands depends on the server (see RFC959 for a
  874. list of mandatory commands).
  875. The valid SFTP commands are: chgrp, chmod, chown, ln, mkdir, pwd,
  876. rename, rm, rmdir, symlink (see
  877. .BR curl (1))
  878. (SFTP support added in 7.16.3)
  879. .IP CURLOPT_POSTQUOTE
  880. Pass a pointer to a linked list of FTP or SFTP commands to pass to the
  881. server after your ftp transfer request. The linked list should be a
  882. fully valid list of struct curl_slist structs properly filled in as
  883. described for \fICURLOPT_QUOTE\fP. Disable this operation again by
  884. setting a NULL to this option.
  885. .IP CURLOPT_PREQUOTE
  886. Pass a pointer to a linked list of FTP commands to pass to the server after
  887. the transfer type is set. The linked list should be a fully valid list of
  888. struct curl_slist structs properly filled in as described for
  889. \fICURLOPT_QUOTE\fP. Disable this operation again by setting a NULL to this
  890. option. Before version 7.15.6, if you also set \fICURLOPT_NOBODY\fP to 1, this
  891. option didn't work.
  892. .IP CURLOPT_DIRLISTONLY
  893. A parameter set to 1 tells the library to just list the names of files in a
  894. directory, instead of doing a full directory listing that would include file
  895. sizes, dates etc. This works for FTP and SFTP URLs.
  896. This causes an FTP NLST command to be sent on an FTP server. Beware
  897. that some FTP servers list only files in their response to NLST; they
  898. might not include subdirectories and symbolic links.
  899. (This option was known as CURLOPT_FTPLISTONLY up to 7.16.4)
  900. .IP CURLOPT_APPEND
  901. A parameter set to 1 tells the library to append to the remote file instead of
  902. overwrite it. This is only useful when uploading to an ftp site.
  903. (This option was known as CURLOPT_FTPAPPEND up to 7.16.4)
  904. .IP CURLOPT_FTP_USE_EPRT
  905. Pass a long. If the value is 1, it tells curl to use the EPRT (and
  906. LPRT) command when doing active FTP downloads (which is enabled by
  907. \fICURLOPT_FTPPORT\fP). Using EPRT means that it will first attempt to use
  908. EPRT and then LPRT before using PORT, but if you pass zero to this
  909. option, it will not try using EPRT or LPRT, only plain PORT. (Added in 7.10.5)
  910. If the server is an IPv6 host, this option will have no effect as of 7.12.3.
  911. .IP CURLOPT_FTP_USE_EPSV
  912. Pass a long. If the value is 1, it tells curl to use the EPSV command
  913. when doing passive FTP downloads (which it always does by default). Using EPSV
  914. means that it will first attempt to use EPSV before using PASV, but if you
  915. pass zero to this option, it will not try using EPSV, only plain PASV.
  916. If the server is an IPv6 host, this option will have no effect as of 7.12.3.
  917. .IP CURLOPT_FTP_CREATE_MISSING_DIRS
  918. Pass a long. If the value is 1, curl will attempt to create any remote
  919. directory that it fails to CWD into. CWD is the command that changes working
  920. directory. (Added in 7.10.7)
  921. This setting also applies to SFTP-connections. curl will attempt to create
  922. the remote directory if it can't obtain a handle to the target-location. The
  923. creation will fail if a file of the same name as the directory to create
  924. already exists or lack of permissions prevents creation. (Added in 7.16.3)
  925. .IP CURLOPT_FTP_RESPONSE_TIMEOUT
  926. Pass a long. Causes curl to set a timeout period (in seconds) on the amount
  927. of time that the server is allowed to take in order to generate a response
  928. message for a command before the session is considered hung. While curl is
  929. waiting for a response, this value overrides \fICURLOPT_TIMEOUT\fP. It is
  930. recommended that if used in conjunction with \fICURLOPT_TIMEOUT\fP, you set
  931. \fICURLOPT_FTP_RESPONSE_TIMEOUT\fP to a value smaller than
  932. \fICURLOPT_TIMEOUT\fP. (Added in 7.10.8)
  933. .IP CURLOPT_FTP_ALTERNATIVE_TO_USER
  934. Pass a char * as parameter, pointing to a string which will be used to
  935. authenticate if the usual FTP "USER user" and "PASS password" negotiation
  936. fails. This is currently only known to be required when connecting to
  937. Tumbleweed's Secure Transport FTPS server using client certificates for
  938. authentication. (Added in 7.15.5)
  939. .IP CURLOPT_FTP_SKIP_PASV_IP
  940. Pass a long. If set to 1, it instructs libcurl to not use the IP address the
  941. server suggests in its 227-response to libcurl's PASV command when libcurl
  942. connects the data connection. Instead libcurl will re-use the same IP address
  943. it already uses for the control connection. But it will use the port number
  944. from the 227-response. (Added in 7.14.2)
  945. This option has no effect if PORT, EPRT or EPSV is used instead of PASV.
  946. .IP CURLOPT_USE_SSL
  947. Pass a long using one of the values from below, to make libcurl use your
  948. desired level of SSL for the ftp transfer. (Added in 7.11.0)
  949. (This option was known as CURLOPT_FTP_SSL up to 7.16.4, and the constants
  950. were known as CURLFTPSSL_*)
  951. .RS
  952. .IP CURLUSESSL_NONE
  953. Don't attempt to use SSL.
  954. .IP CURLUSESSL_TRY
  955. Try using SSL, proceed as normal otherwise.
  956. .IP CURLUSESSL_CONTROL
  957. Require SSL for the control connection or fail with \fICURLE_USE_SSL_FAILED\fP.
  958. .IP CURLUSESSL_ALL
  959. Require SSL for all communication or fail with \fICURLE_USE_SSL_FAILED\fP.
  960. .RE
  961. .IP CURLOPT_FTPSSLAUTH
  962. Pass a long using one of the values from below, to alter how libcurl issues
  963. \&"AUTH TLS" or "AUTH SSL" when FTP over SSL is activated (see
  964. \fICURLOPT_FTP_SSL\fP). (Added in 7.12.2)
  965. .RS
  966. .IP CURLFTPAUTH_DEFAULT
  967. Allow libcurl to decide
  968. .IP CURLFTPAUTH_SSL
  969. Try "AUTH SSL" first, and only if that fails try "AUTH TLS"
  970. .IP CURLFTPAUTH_TLS
  971. Try "AUTH TLS" first, and only if that fails try "AUTH SSL"
  972. .RE
  973. .IP CURLOPT_FTP_SSL_CCC
  974. If enabled, this option makes libcurl use CCC (Clear Command Channel). It
  975. shuts down the SSL/TLS layer after authenticating. The rest of the
  976. control channel communication will be unencrypted. This allows NAT routers
  977. to follow the FTP transaction. Pass a long using one of the values below.
  978. (Added in 7.16.1)
  979. .RS
  980. .IP CURLFTPSSL_CCC_NONE
  981. Don't attempt to use CCC.
  982. .IP CURLFTPSSL_CCC_PASSIVE
  983. Do not initiate the shutdown, but wait for the server to do it. Do not send
  984. a reply.
  985. .IP CURLFTPSSL_CCC_ACTIVE
  986. Initiate the shutdown and wait for a reply.
  987. .RE
  988. .IP CURLOPT_FTP_ACCOUNT
  989. Pass a pointer to a zero-terminated string (or NULL to disable). When an FTP
  990. server asks for "account data" after user name and password has been provided,
  991. this data is sent off using the ACCT command. (Added in 7.13.0)
  992. .IP CURLOPT_FTP_FILEMETHOD
  993. Pass a long that should have one of the following values. This option controls
  994. what method libcurl should use to reach a file on a FTP(S) server. The
  995. argument should be one of the following alternatives:
  996. .RS
  997. .IP CURLFTPMETHOD_MULTICWD
  998. libcurl does a single CWD operation for each path part in the given URL. For
  999. deep hierarchies this means very many commands. This is how RFC1738 says it
  1000. should be done. This is the default but the slowest behavior.
  1001. .IP CURLFTPMETHOD_NOCWD
  1002. libcurl does no CWD at all. libcurl will do SIZE, RETR, STOR etc and give a
  1003. full path to the server for all these commands. This is the fastest behavior.
  1004. .IP CURLFTPMETHOD_SINGLECWD
  1005. libcurl does one CWD with the full target directory and then operates on the
  1006. file \&"normally" (like in the multicwd case). This is somewhat more standards
  1007. compliant than 'nocwd' but without the full penalty of 'multicwd'.
  1008. .RE
  1009. .SH PROTOCOL OPTIONS
  1010. .IP CURLOPT_TRANSFERTEXT
  1011. A parameter set to 1 tells the library to use ASCII mode for ftp transfers,
  1012. instead of the default binary transfer. For win32 systems it does not set the
  1013. stdout to binary mode. This option can be usable when transferring text data
  1014. between systems with different views on certain characters, such as newlines
  1015. or similar.
  1016. libcurl does not do a complete ASCII conversion when doing ASCII transfers
  1017. over FTP. This is a known limitation/flaw that nobody has rectified. libcurl
  1018. simply sets the mode to ascii and performs a standard transfer.
  1019. .IP CURLOPT_PROXY_TRANSFER_MODE
  1020. Pass a long. If the value is set to 1 (one), it tells libcurl to set the
  1021. transfer mode (binary or ASCII) for FTP transfers done via an HTTP proxy, by
  1022. appending ;type=a or ;type=i to the URL. Without this setting, or it being set
  1023. to 0 (zero, the default), \fICURLOPT_TRANSFERTEXT\fP has no effect when doing
  1024. FTP via a proxy. Beware that not all proxies support this feature. (Added in
  1025. 7.18.0)
  1026. .IP CURLOPT_CRLF
  1027. Convert Unix newlines to CRLF newlines on transfers.
  1028. .IP CURLOPT_RANGE
  1029. Pass a char * as parameter, which should contain the specified range you
  1030. want. It should be in the format "X-Y", where X or Y may be left out. HTTP
  1031. transfers also support several intervals, separated with commas as in
  1032. \fI"X-Y,N-M"\fP. Using this kind of multiple intervals will cause the HTTP
  1033. server to send the response document in pieces (using standard MIME separation
  1034. techniques). Pass a NULL to this option to disable the use of ranges.
  1035. Ranges work on HTTP, FTP and FILE (since 7.18.0) transfers only.
  1036. .IP CURLOPT_RESUME_FROM
  1037. Pass a long as parameter. It contains the offset in number of bytes that you
  1038. want the transfer to start from. Set this option to 0 to make the transfer
  1039. start from the beginning (effectively disabling resume). For FTP, set this
  1040. option to -1 to make the transfer start from the end of the target file
  1041. (useful to continue an interrupted upload).
  1042. .IP CURLOPT_RESUME_FROM_LARGE
  1043. Pass a curl_off_t as parameter. It contains the offset in number of bytes that
  1044. you want the transfer to start from. (Added in 7.11.0)
  1045. .IP CURLOPT_CUSTOMREQUEST
  1046. Pass a pointer to a zero terminated string as parameter. It will be used
  1047. instead of GET or HEAD when doing an HTTP request, or instead of LIST or NLST
  1048. when doing an ftp directory listing. This is useful for doing DELETE or other
  1049. more or less obscure HTTP requests. Don't do this at will, make sure your
  1050. server supports the command first.
  1051. Note that libcurl will still act and assume the keyword it would use if you
  1052. didn't set your custom one is the one in use and it will act according to
  1053. that. Thus, changing this to a HEAD when libcurl otherwise would do a GET
  1054. might cause libcurl to act funny, and similar. To switch to a proper HEAD, use
  1055. \fICURLOPT_NOBODY\fP, to switch to a proper POST, use \fICURLOPT_POST\fP or
  1056. \fICURLOPT_POSTFIELDS\fP and so on.
  1057. Restore to the internal default by setting this to NULL.
  1058. Many people have wrongly used this option to replace the entire request with
  1059. their own, including multiple headers and POST contents. While that might work
  1060. in many cases, it will cause libcurl to send invalid requests and it could
  1061. possibly confuse the remote server badly. Use \fICURLOPT_POST\fP and
  1062. \fICURLOPT_POSTFIELDS\fP to set POST data. Use \fICURLOPT_HTTPHEADER\fP to
  1063. replace or extend the set of headers sent by libcurl. Use
  1064. \fICURLOPT_HTTP_VERSION\fP to change HTTP version.
  1065. .IP CURLOPT_FILETIME
  1066. Pass a long. If it is 1, libcurl will attempt to get the modification date of
  1067. the remote document in this operation. This requires that the remote server
  1068. sends the time or replies to a time querying command. The
  1069. \fIcurl_easy_getinfo(3)\fP function with the \fICURLINFO_FILETIME\fP argument
  1070. can be used after a transfer to extract the received time (if any).
  1071. .IP CURLOPT_NOBODY
  1072. A parameter set to 1 tells the library to not include the body-part in the
  1073. output. This is only relevant for protocols that have separate header and body
  1074. parts. On HTTP(S) servers, this will make libcurl do a HEAD request.
  1075. To change request to GET, you should use \fICURLOPT_HTTPGET\fP. Change request
  1076. to POST with \fICURLOPT_POST\fP etc.
  1077. .IP CURLOPT_INFILESIZE
  1078. When uploading a file to a remote site, this option should be used to tell
  1079. libcurl what the expected size of the infile is. This value should be passed
  1080. as a long. See also \fICURLOPT_INFILESIZE_LARGE\fP.
  1081. For uploading using SCP, this option or \fICURLOPT_INFILESIZE_LARGE\fP is
  1082. mandatory.
  1083. Note that this option does not limit how much data libcurl will actually send,
  1084. as that is controlled entirely by what the read callback returns.
  1085. .IP CURLOPT_INFILESIZE_LARGE
  1086. When uploading a file to a remote site, this option should be used to tell
  1087. libcurl what the expected size of the infile is. This value should be passed
  1088. as a curl_off_t. (Added in 7.11.0)
  1089. For uploading using SCP, this option or \fICURLOPT_INFILESIZE\fP is mandatory.
  1090. Note that this option does not limit how much data libcurl will actually send,
  1091. as that is controlled entirely by what the read callback returns.
  1092. .IP CURLOPT_UPLOAD
  1093. A parameter set to 1 tells the library to prepare for an upload. The
  1094. \fICURLOPT_READDATA\fP and \fICURLOPT_INFILESIZE\fP or
  1095. \fICURLOPT_INFILESIZE_LARGE\fP options are also interesting for uploads. If
  1096. the protocol is HTTP, uploading means using the PUT request unless you tell
  1097. libcurl otherwise.
  1098. Using PUT with HTTP 1.1 implies the use of a "Expect: 100-continue" header.
  1099. You can disable this header with \fICURLOPT_HTTPHEADER\fP as usual.
  1100. If you use PUT to a HTTP 1.1 server, you can upload data without knowing the
  1101. size before starting the transfer if you use chunked encoding. You enable this
  1102. by adding a header like "Transfer-Encoding: chunked" with
  1103. \fICURLOPT_HTTPHEADER\fP. With HTTP 1.0 or without chunked transfer, you must
  1104. specify the size.
  1105. .IP CURLOPT_MAXFILESIZE
  1106. Pass a long as parameter. This allows you to specify the maximum size (in
  1107. bytes) of a file to download. If the file requested is larger than this value,
  1108. the transfer will not start and CURLE_FILESIZE_EXCEEDED will be returned.
  1109. The file size is not always known prior to download, and for such files this
  1110. option has no effect even if the file transfer ends up being larger than this
  1111. given limit. This concerns both FTP and HTTP transfers.
  1112. .IP CURLOPT_MAXFILESIZE_LARGE
  1113. Pass a curl_off_t as parameter. This allows you to specify the maximum size
  1114. (in bytes) of a file to download. If the file requested is larger than this
  1115. value, the transfer will not start and \fICURLE_FILESIZE_EXCEEDED\fP will be
  1116. returned. (Added in 7.11.0)
  1117. The file size is not always known prior to download, and for such files this
  1118. option has no effect even if the file transfer ends up being larger than this
  1119. given limit. This concerns both FTP and HTTP transfers.
  1120. .IP CURLOPT_TIMECONDITION
  1121. Pass a long as parameter. This defines how the \fICURLOPT_TIMEVALUE\fP time
  1122. value is treated. You can set this parameter to \fICURL_TIMECOND_IFMODSINCE\fP
  1123. or \fICURL_TIMECOND_IFUNMODSINCE\fP. This feature applies to HTTP and FTP.
  1124. The last modification time of a file is not always known and in such instances
  1125. this feature will have no effect even if the given time condition would have
  1126. not been met.
  1127. .IP CURLOPT_TIMEVALUE
  1128. Pass a long as parameter. This should be the time in seconds since 1 jan 1970,
  1129. and the time will be used in a condition as specified with
  1130. \fICURLOPT_TIMECONDITION\fP.
  1131. .SH CONNECTION OPTIONS
  1132. .IP CURLOPT_TIMEOUT
  1133. Pass a long as parameter containing the maximum time in seconds that you allow
  1134. the libcurl transfer operation to take. Normally, name lookups can take a
  1135. considerable time and limiting operations to less than a few minutes risk
  1136. aborting perfectly normal operations. This option will cause curl to use the
  1137. SIGALRM to enable time-outing system calls.
  1138. In unix-like systems, this might cause signals to be used unless
  1139. \fICURLOPT_NOSIGNAL\fP is set.
  1140. .IP CURLOPT_TIMEOUT_MS
  1141. Like \fICURLOPT_TIMEOUT\fP but takes number of milliseconds instead. If
  1142. libcurl is built to use the standard system name resolver, that part will
  1143. still use full-second resolution for timeouts. (Added in 7.16.2)
  1144. .IP CURLOPT_LOW_SPEED_LIMIT
  1145. Pass a long as parameter. It contains the transfer speed in bytes per second
  1146. that the transfer should be below during \fICURLOPT_LOW_SPEED_TIME\fP seconds
  1147. for the library to consider it too slow and abort.
  1148. .IP CURLOPT_LOW_SPEED_TIME
  1149. Pass a long as parameter. It contains the time in seconds that the transfer
  1150. should be below the \fICURLOPT_LOW_SPEED_LIMIT\fP for the library to consider
  1151. it too slow and abort.
  1152. .IP CURLOPT_MAX_SEND_SPEED_LARGE
  1153. Pass a curl_off_t as parameter. If an upload exceeds this speed on cumulative
  1154. average during the transfer, the transfer will pause to keep the average rate
  1155. less than or equal to the parameter value. Defaults to unlimited
  1156. speed. (Added in 7.15.5)
  1157. .IP CURLOPT_MAX_RECV_SPEED_LARGE
  1158. Pass a curl_off_t as parameter. If a download exceeds this speed on
  1159. cumulative average during the transfer, the transfer will pause to keep the
  1160. average rate less than or equal to the parameter value. Defaults to unlimited
  1161. speed. (Added in 7.15.5)
  1162. .IP CURLOPT_MAXCONNECTS
  1163. Pass a long. The set number will be the persistent connection cache size. The
  1164. set amount will be the maximum amount of simultaneously open connections that
  1165. libcurl may cache in this easy handle. Default is 5, and there isn't much
  1166. point in changing this value unless you are perfectly aware of how this work
  1167. and changes libcurl's behaviour. This concerns connection using any of the
  1168. protocols that support persistent connections.
  1169. When reaching the maximum limit, curl closes the oldest one in the cache to
  1170. prevent the number of open connections to increase.
  1171. If you already have performed transfers with this curl handle, setting a
  1172. smaller MAXCONNECTS than before may cause open connections to get closed
  1173. unnecessarily.
  1174. Note that if you add this easy handle to a multi handle, this setting is not
  1175. being acknowledged, but you must instead use \fIcurl_multi_setopt(3)\fP and
  1176. the \fICURLMOPT_MAXCONNECTS\fP option.
  1177. .IP CURLOPT_CLOSEPOLICY
  1178. (Obsolete) This option does nothing.
  1179. .IP CURLOPT_FRESH_CONNECT
  1180. Pass a long. Set to 1 to make the next transfer use a new (fresh) connection
  1181. by force. If the connection cache is full before this connection, one of the
  1182. existing connections will be closed as according to the selected or default
  1183. policy. This option should be used with caution and only if you understand
  1184. what it does. Set this to 0 to have libcurl attempt re-using an existing
  1185. connection (default behavior).
  1186. .IP CURLOPT_FORBID_REUSE
  1187. Pass a long. Set to 1 to make the next transfer explicitly close the
  1188. connection when done. Normally, libcurl keep all connections alive when done
  1189. with one transfer in case there comes a succeeding one that can re-use them.
  1190. This option should be used with caution and only if you understand what it
  1191. does. Set to 0 to have libcurl keep the connection open for possibly later
  1192. re-use (default behavior).
  1193. .IP CURLOPT_CONNECTTIMEOUT
  1194. Pass a long. It should contain the maximum time in seconds that you allow the
  1195. connection to the server to take. This only limits the connection phase, once
  1196. it has connected, this option is of no more use. Set to zero to disable
  1197. connection timeout (it will then only timeout on the system's internal
  1198. timeouts). See also the \fICURLOPT_TIMEOUT\fP option.
  1199. In unix-like systems, this might cause signals to be used unless
  1200. \fICURLOPT_NOSIGNAL\fP is set.
  1201. .IP CURLOPT_CONNECTTIMEOUT_MS
  1202. Like \fICURLOPT_CONNECTTIMEOUT\fP but takes number of milliseconds instead. If
  1203. libcurl is built to use the standard system name resolver, that part will
  1204. still use full-second resolution for timeouts. (Added in 7.16.2)
  1205. .IP CURLOPT_IPRESOLVE
  1206. Allows an application to select what kind of IP addresses to use when
  1207. resolving host names. This is only interesting when using host names that
  1208. resolve addresses using more than one version of IP. The allowed values are:
  1209. .RS
  1210. .IP CURL_IPRESOLVE_WHATEVER
  1211. Default, resolves addresses to all IP versions that your system allows.
  1212. .IP CURL_IPRESOLVE_V4
  1213. Resolve to ipv4 addresses.
  1214. .IP CURL_IPRESOLVE_V6
  1215. Resolve to ipv6 addresses.
  1216. .RE
  1217. .IP CURLOPT_CONNECT_ONLY
  1218. Pass a long. If the parameter equals 1, it tells the library to perform all
  1219. the required proxy authentication and connection setup, but no data transfer.
  1220. This option is useful with the \fICURLINFO_LASTSOCKET\fP option to
  1221. \fIcurl_easy_getinfo(3)\fP. The library can set up the connection and then the
  1222. application can obtain the most recently used socket for special data
  1223. transfers. (Added in 7.15.2)
  1224. .SH SSL and SECURITY OPTIONS
  1225. .IP CURLOPT_SSLCERT
  1226. Pass a pointer to a zero terminated string as parameter. The string should be
  1227. the file name of your certificate. The default format is "PEM" and can be
  1228. changed with \fICURLOPT_SSLCERTTYPE\fP.
  1229. With NSS this is the nickname of the certificate you wish to authenticate
  1230. with.
  1231. .IP CURLOPT_SSLCERTTYPE
  1232. Pass a pointer to a zero terminated string as parameter. The string should be
  1233. the format of your certificate. Supported formats are "PEM" and "DER". (Added
  1234. in 7.9.3)
  1235. .IP CURLOPT_SSLKEY
  1236. Pass a pointer to a zero terminated string as parameter. The string should be
  1237. the file name of your private key. The default format is "PEM" and can be
  1238. changed with \fICURLOPT_SSLKEYTYPE\fP.
  1239. .IP CURLOPT_SSLKEYTYPE
  1240. Pass a pointer to a zero terminated string as parameter. The string should be
  1241. the format of your private key. Supported formats are "PEM", "DER" and "ENG".
  1242. The format "ENG" enables you to load the private key from a crypto engine. In
  1243. this case \fICURLOPT_SSLKEY\fP is used as an identifier passed to the
  1244. engine. You have to set the crypto engine with \fICURLOPT_SSLENGINE\fP.
  1245. \&"DER" format key file currently does not work because of a bug in OpenSSL.
  1246. .IP CURLOPT_KEYPASSWD
  1247. Pass a pointer to a zero terminated string as parameter. It will be used as
  1248. the password required to use the \fICURLOPT_SSLKEY\fP or
  1249. \fICURLOPT_SSH_PRIVATE_KEYFILE\fP private key.
  1250. You never needed a pass phrase to load a certificate but you need one to
  1251. load your private key.
  1252. (This option was known as CURLOPT_SSLKEYPASSWD up to 7.16.4 and
  1253. CURLOPT_SSLCERTPASSWD up to 7.9.2)
  1254. .IP CURLOPT_SSLENGINE
  1255. Pass a pointer to a zero terminated string as parameter. It will be used as
  1256. the identifier for the crypto engine you want to use for your private
  1257. key.
  1258. If the crypto device cannot be loaded, \fICURLE_SSL_ENGINE_NOTFOUND\fP is
  1259. returned.
  1260. .IP CURLOPT_SSLENGINE_DEFAULT
  1261. Sets the actual crypto engine as the default for (asymmetric) crypto
  1262. operations.
  1263. If the crypto device cannot be set, \fICURLE_SSL_ENGINE_SETFAILED\fP is
  1264. returned.
  1265. Note that even though this option doesn't need any parameter, in some
  1266. configurations \fIcurl_easy_setopt\fP might be defined as a macro taking
  1267. exactly three arguments. Therefore, it's recommended to pass 1 as parameter to
  1268. this option.
  1269. .IP CURLOPT_SSLVERSION
  1270. Pass a long as parameter to control what version of SSL/TLS to attempt to use.
  1271. The available options are:
  1272. .RS
  1273. .IP CURL_SSLVERSION_DEFAULT
  1274. The default action. This will attempt to figure out the remote SSL protocol
  1275. version, i.e. either SSLv3 or TLSv1 (but not SSLv2, which became disabled
  1276. by default with 7.18.1).
  1277. .IP CURL_SSLVERSION_TLSv1
  1278. Force TLSv1
  1279. .IP CURL_SSLVERSION_SSLv2
  1280. Force SSLv2
  1281. .IP CURL_SSLVERSION_SSLv3
  1282. Force SSLv3
  1283. .RE
  1284. .IP CURLOPT_SSL_VERIFYPEER
  1285. Pass a long as parameter.
  1286. This option determines whether curl verifies the authenticity of the peer's
  1287. certificate. A value of 1 means curl verifies; zero means it doesn't. The
  1288. default is nonzero, but before 7.10, it was zero.
  1289. When negotiating an SSL connection, the server sends a certificate indicating
  1290. its identity. Curl verifies whether the certificate is authentic, i.e. that
  1291. you can trust that the server is who the certificate says it is. This trust
  1292. is based on a chain of digital signatures, rooted in certification authority
  1293. (CA) certificates you supply. As of 7.10, curl installs a default bundle of
  1294. CA certificates and you can specify alternate certificates with the
  1295. \fICURLOPT_CAINFO\fP option or the \fICURLOPT_CAPATH\fP option.
  1296. When \fICURLOPT_SSL_VERIFYPEER\fP is nonzero, and the verification fails to
  1297. prove that the certificate is authentic, the connection fails. When the
  1298. option is zero, the connection succeeds regardless.
  1299. Authenticating the certificate is not by itself very useful. You typically
  1300. want to ensure that the server, as authentically identified by its
  1301. certificate, is the server you mean to be talking to. Use
  1302. \fICURLOPT_SSL_VERIFYHOST\fP to control that.
  1303. .IP CURLOPT_CAINFO
  1304. Pass a char * to a zero terminated string naming a file holding one or more
  1305. certificates to verify the peer with. This makes sense only when used in
  1306. combination with the \fICURLOPT_SSL_VERIFYPEER\fP option. If
  1307. \fICURLOPT_SSL_VERIFYPEER\fP is zero, \fICURLOPT_CAINFO\fP need not
  1308. even indicate an accessible file.
  1309. Note that option is by default set to the system path where libcurl's cacert
  1310. bundle is assumed to be stored, as established at build time.
  1311. When built against NSS this is the directory that the NSS certificate
  1312. database resides in.
  1313. .IP CURLOPT_ISSUERCERT
  1314. Pass a char * to a zero terminated string naming a file holding a CA
  1315. certificate in PEM format. If the option is set, an additional check against
  1316. the peer certificate is performed to verify the issuer is indeed the one
  1317. associated with the certificate provided by the option. This additional check
  1318. is useful in multi-level PKI where one need to enforce the peer certificate is
  1319. from a specific branch of the tree.
  1320. This option makes sense only when used in combination with the
  1321. \fICURLOPT_SSL_VERIFYPEER\fP option. Otherwise, the result of the check is not
  1322. considered as failure.
  1323. A specific error code (CURLE_SSL_ISSUER_ERROR) is defined with the option,
  1324. which is returned if the setup of the SSL/TLS session has failed due to a
  1325. mismatch with the issuer of peer certificate (\fICURLOPT_SSL_VERIFYPEER\fP has
  1326. to be set too for the check to fail). (Added in 7.19.0)
  1327. .IP CURLOPT_CAPATH
  1328. Pass a char * to a zero terminated string naming a directory holding multiple
  1329. CA certificates to verify the peer with. The certificate directory must be
  1330. prepared using the openssl c_rehash utility. This makes sense only when used
  1331. in combination with the \fICURLOPT_SSL_VERIFYPEER\fP option. If
  1332. \fICURLOPT_SSL_VERIFYPEER\fP is zero, \fICURLOPT_CAPATH\fP need not even
  1333. indicate an accessible path. The \fICURLOPT_CAPATH\fP function apparently
  1334. does not work in Windows due to some limitation in openssl. This option is
  1335. OpenSSL-specific and does nothing if libcurl is built to use GnuTLS.
  1336. .IP CURLOPT_CRLFILE
  1337. Pass a char * to a zero terminated string naming a file with the concatenation
  1338. of CRL (in PEM format) to use in the certificate validation that occurs during
  1339. the SSL exchange.
  1340. When curl is built to use NSS or GnuTLS, there is no way to influence the use
  1341. of CRL passed to help in the verification process. When libcurl is built with
  1342. OpenSSL support, X509_V_FLAG_CRL_CHECK and X509_V_FLAG_CRL_CHECK_ALL are both
  1343. set, requiring CRL check against all the elements of the certificate chain if
  1344. a CRL file is passed.
  1345. This option makes sense only when used in combination with the
  1346. \fICURLOPT_SSL_VERIFYPEER\fP option.
  1347. A specific error code (CURLE_SSL_CRL_BADFILE) is defined with the option. It
  1348. is returned when the SSL exchange fails because the CRL file cannot be loaded.
  1349. Note that a failure in certificate verification due to a revocation information
  1350. found in the CRL does not trigger this specific error. (Added in 7.19.0)
  1351. .IP CURLOPT_RANDOM_FILE
  1352. Pass a char * to a zero terminated file name. The file will be used to read
  1353. from to seed the random engine for SSL. The more random the specified file is,
  1354. the more secure the SSL connection will become.
  1355. .IP CURLOPT_EGDSOCKET
  1356. Pass a char * to the zero terminated path name to the Entropy Gathering Daemon
  1357. socket. It will be used to seed the random engine for SSL.
  1358. .IP CURLOPT_SSL_VERIFYHOST
  1359. Pass a long as parameter.
  1360. This option determines whether libcurl verifies that the server cert is for
  1361. the server it is known as.
  1362. When negotiating an SSL connection, the server sends a certificate indicating
  1363. its identity.
  1364. When \fICURLOPT_SSL_VERIFYHOST\fP is 2, that certificate must indicate that
  1365. the server is the server to which you meant to connect, or the connection
  1366. fails.
  1367. Curl considers the server the intended one when the Common Name field or a
  1368. Subject Alternate Name field in the certificate matches the host name in the
  1369. URL to which you told Curl to connect.
  1370. When the value is 1, the certificate must contain a Common Name field, but it
  1371. doesn't matter what name it says. (This is not ordinarily a useful setting).
  1372. When the value is 0, the connection succeeds regardless of the names in the
  1373. certificate.
  1374. The default, since 7.10, is 2.
  1375. The checking this option controls is of the identity that the server
  1376. \fIclaims\fP. The server could be lying. To control lying, see
  1377. \fICURLOPT_SSL_VERIFYPEER\fP.
  1378. .IP CURLOPT_SSL_CIPHER_LIST
  1379. Pass a char *, pointing to a zero terminated string holding the list of
  1380. ciphers to use for the SSL connection. The list must be syntactically correct,
  1381. it consists of one or more cipher strings separated by colons. Commas or spaces
  1382. are also acceptable separators but colons are normally used, \!, \- and \+ can
  1383. be used as operators.
  1384. For OpenSSL and GnuTLS valid examples of cipher lists include 'RC4-SHA',
  1385. \'SHA1+DES\', 'TLSv1' and 'DEFAULT'. The default list is normally set when you
  1386. compile OpenSSL.
  1387. You'll find more details about cipher lists on this URL:
  1388. \fIhttp://www.openssl.org/docs/apps/ciphers.html\fP
  1389. For NSS valid examples of cipher lists include 'rsa_rc4_128_md5',
  1390. \'rsa_aes_128_sha\', etc. With NSS you don't add/remove ciphers. If one uses
  1391. this option then all known ciphers are disabled and only those passed in
  1392. are enabled.
  1393. You'll find more details about the NSS cipher lists on this URL:
  1394. \fIhttp://directory.fedora.redhat.com/docs/mod_nss.html#Directives\fP
  1395. .IP CURLOPT_SSL_SESSIONID_CACHE
  1396. Pass a long set to 0 to disable libcurl's use of SSL session-ID caching. Set
  1397. this to 1 to enable it. By default all transfers are done using the
  1398. cache. Note that while nothing ever should get hurt by attempting to reuse SSL
  1399. session-IDs, there seem to be broken SSL implementations in the wild that may
  1400. require you to disable this in order for you to succeed. (Added in 7.16.0)
  1401. .IP CURLOPT_KRBLEVEL
  1402. Pass a char * as parameter. Set the kerberos security level for FTP; this
  1403. also enables kerberos awareness. This is a string, 'clear', 'safe',
  1404. 'confidential' or \&'private'. If the string is set but doesn't match one
  1405. of these, 'private' will be used. Set the string to NULL to disable kerberos
  1406. support for FTP.
  1407. (This option was known as CURLOPT_KRB4LEVEL up to 7.16.3)
  1408. .SH SSH OPTIONS
  1409. .IP CURLOPT_SSH_AUTH_TYPES
  1410. Pass a long set to a bitmask consisting of one or more of
  1411. CURLSSH_AUTH_PUBLICKEY, CURLSSH_AUTH_PASSWORD, CURLSSH_AUTH_HOST,
  1412. CURLSSH_AUTH_KEYBOARD. Set CURLSSH_AUTH_ANY to let libcurl pick one.
  1413. (Added in 7.16.1)
  1414. .IP CURLOPT_SSH_HOST_PUBLIC_KEY_MD5
  1415. Pass a char * pointing to a string containing 32 hexadecimal digits. The
  1416. string should be the 128 bit MD5 checksum of the remote host's public key, and
  1417. libcurl will reject the connection to the host unless the md5sums match. This
  1418. option is only for SCP and SFTP transfers. (Added in 7.17.1)
  1419. .IP CURLOPT_SSH_PUBLIC_KEYFILE
  1420. Pass a char * pointing to a file name for your public key. If not used,
  1421. libcurl defaults to using \fB~/.ssh/id_dsa.pub\fP.
  1422. (Added in 7.16.1)
  1423. .IP CURLOPT_SSH_PRIVATE_KEYFILE
  1424. Pass a char * pointing to a file name for your private key. If not used,
  1425. libcurl defaults to using \fB~/.ssh/id_dsa\fP.
  1426. If the file is password-protected, set the password with \fICURLOPT_KEYPASSWD\fP.
  1427. (Added in 7.16.1)
  1428. .SH OTHER OPTIONS
  1429. .IP CURLOPT_PRIVATE
  1430. Pass a void * as parameter, pointing to data that should be associated with
  1431. this curl handle. The pointer can subsequently be retrieved using
  1432. \fIcurl_easy_getinfo(3)\fP with the CURLINFO_PRIVATE option. libcurl itself
  1433. does nothing with this data. (Added in 7.10.3)
  1434. .IP CURLOPT_SHARE
  1435. Pass a share handle as a parameter. The share handle must have been created by
  1436. a previous call to \fIcurl_share_init(3)\fP. Setting this option, will make
  1437. this curl handle use the data from the shared handle instead of keeping the
  1438. data to itself. This enables several curl handles to share data. If the curl
  1439. handles are used simultaneously, you \fBMUST\fP use the locking methods in the
  1440. share handle. See \fIcurl_share_setopt(3)\fP for details.
  1441. If you add a share that is set to share cookies, your easy handle will use
  1442. that cookie cache and get the cookie engine enabled. If you unshare an object
  1443. that were using cookies (or change to another object that doesn't share
  1444. cookies), the easy handle will get its cookie engine disabled.
  1445. Data that the share object is not set to share will be dealt with the usual
  1446. way, as if no share was used.
  1447. .IP CURLOPT_NEW_FILE_PERMS
  1448. Pass a long as a parameter, containing the value of the permissions that will
  1449. be assigned to newly created files on the remote server. The default value is
  1450. \fI0644\fP, but any valid value can be used. The only protocols that can use
  1451. this are \fIsftp://\fP, \fIscp://\fP and \fIfile://\fP. (Added in 7.16.4)
  1452. .IP CURLOPT_NEW_DIRECTORY_PERMS
  1453. Pass a long as a parameter, containing the value of the permissions that will
  1454. be assigned to newly created directories on the remote server. The default
  1455. value is \fI0755\fP, but any valid value can be used. The only protocols that
  1456. can use this are \fIsftp://\fP, \fIscp://\fP and \fIfile://\fP.
  1457. (Added in 7.16.4)
  1458. .SH TELNET OPTIONS
  1459. .IP CURLOPT_TELNETOPTIONS
  1460. Provide a pointer to a curl_slist with variables to pass to the telnet
  1461. negotiations. The variables should be in the format <option=value>. libcurl
  1462. supports the options 'TTYPE', 'XDISPLOC' and 'NEW_ENV'. See the TELNET
  1463. standard for details.
  1464. .SH RETURN VALUE
  1465. CURLE_OK (zero) means that the option was set properly, non-zero means an
  1466. error occurred as \fI<curl/curl.h>\fP defines. See the \fIlibcurl-errors(3)\fP
  1467. man page for the full list with descriptions.
  1468. If you try to set an option that libcurl doesn't know about, perhaps because
  1469. the library is too old to support it or the option was removed in a recent
  1470. version, this function will return \fICURLE_FAILED_INIT\fP.
  1471. .SH "SEE ALSO"
  1472. .BR curl_easy_init "(3), " curl_easy_cleanup "(3), " curl_easy_reset "(3)"