curl_easy_setopt.3 119 KB

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