curl_easy_setopt.3 102 KB

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