1curl_easy_setopt(3) libcurl Manual curl_easy_setopt(3)
2
3
4
6 curl_easy_setopt - set options for a curl easy handle
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLoption option, parameter);
12
14 curl_easy_setopt() is used to tell libcurl how to behave. By using the
15 appropriate options to curl_easy_setopt, you can change libcurl's
16 behavior. All options are set with the option followed by a parameter.
17 That parameter can be a long, a function pointer, an object pointer or
18 a curl_off_t, depending on what the specific option expects. Read this
19 manual carefully as bad input values may cause libcurl to behave badly!
20 You can only set one option in each function call. A typical applica‐
21 tion uses many curl_easy_setopt() calls in the setup phase.
22
23 Options set with this function call are valid for all forthcoming
24 transfers performed using this handle. The options are not in any way
25 reset between transfers, so if you want subsequent transfers with dif‐
26 ferent options, you must change them between the transfers. You can
27 optionally reset all options back to internal default with
28 curl_easy_reset(3).
29
30 Strings passed to libcurl as 'char *' arguments, are copied by the
31 library; thus the string storage associated to the pointer argument may
32 be overwritten after curl_easy_setopt() returns. Exceptions to this
33 rule are described in the option details below.
34
35 Before version 7.17.0, strings were not copied. Instead the user was
36 forced keep them available until libcurl no longer needed them.
37
38 The handle is the return code from a curl_easy_init(3) or
39 curl_easy_duphandle(3) call.
40
42 CURLOPT_VERBOSE
43 Set the parameter to 1 to get the library to display a lot of
44 verbose information about its operations. Very useful for
45 libcurl and/or protocol debugging and understanding. The verbose
46 information will be sent to stderr, or the stream set with CUR‐
47 LOPT_STDERR.
48
49 You hardly ever want this set in production use, you will almost
50 always want this when you debug/report problems. Another neat
51 option for debugging is the CURLOPT_DEBUGFUNCTION.
52
53 CURLOPT_HEADER
54 A parameter set to 1 tells the library to include the header in
55 the body output. This is only relevant for protocols that actu‐
56 ally have headers preceding the data (like HTTP).
57
58 CURLOPT_NOPROGRESS
59 A parameter set to 1 tells the library to shut off the built-in
60 progress meter completely.
61
62 Future versions of libcurl are likely to not have any built-in
63 progress meter at all.
64
65 CURLOPT_NOSIGNAL
66 Pass a long. If it is 1, libcurl will not use any functions that
67 install signal handlers or any functions that cause signals to
68 be sent to the process. This option is mainly here to allow
69 multi-threaded unix applications to still set/use all timeout
70 options etc, without risking getting signals. (Added in 7.10)
71
72 If this option is set and libcurl has been built with the stan‐
73 dard name resolver, timeouts will not occur while the name
74 resolve takes place. Consider building libcurl with c-ares sup‐
75 port to enable asynchronous DNS lookups, which enables nice
76 timeouts for name resolves without signals.
77
78 CURLOPT_WILDCARDMATCH
79 Set this option to 1 if you want to transfer multiple files
80 according to a file name pattern. The pattern can be specified
81 as part of the CURLOPT_URL option, using an fnmatch-like pattern
82 (Shell Pattern Matching) in the last part of URL (file name).
83
84 By default, libcurl uses its internal wildcard matching imple‐
85 mentation. You can provide your own matching function by the
86 CURLOPT_FNMATCH_FUNCTION option.
87
88 This feature is only supported by the FTP download for now.
89
90 A brief introduction of its syntax follows:
91
92 * - ASTERISK
93 ftp://example.com/some/path/*.txt (for all txt's from the
94 root directory)
95
96 ? - QUESTION MARK
97 Question mark matches any (exactly one) character.
98
99 ftp://example.com/some/path/photo?.jpeg
100
101 [ - BRACKET EXPRESSION
102 The left bracket opens a bracket expression. The question
103 mark and asterisk have no special meaning in a bracket
104 expression. Each bracket expression ends by the right
105 bracket and matches exactly one character. Some examples
106 follow:
107
108 [a-zA-Z0-9] or [f-gF-G] - character interval
109
110 [abc] - character enumeration
111
112 [^abc] or [!abc] - negation
113
114 [[:name:]] class expression. Supported classes are
115 alnum,lower, space, alpha, digit, print, upper, blank,
116 graph, xdigit.
117
118 [][-!^] - special case - matches only '-', ']', '[', '!'
119 or '^'. These characters have no special purpose.
120
121 [\[\]\\] - escape syntax. Matches '[', ']' or '\'.
122
123 Using the rules above, a file name pattern can be con‐
124 structed:
125
126 ftp://example.com/some/path/[a-z[:upper:]\\].jpeg
127
128 (This was added in 7.21.0)
129
131 CURLOPT_WRITEFUNCTION
132 Function pointer that should match the following prototype:
133 size_t function( void *ptr, size_t size, size_t nmemb, void
134 *stream); This function gets called by libcurl as soon as there
135 is data received that needs to be saved. The size of the data
136 pointed to by ptr is size multiplied with nmemb, it will not be
137 zero terminated. Return the number of bytes actually taken care
138 of. If that amount differs from the amount passed to your func‐
139 tion, it'll signal an error to the library. This will abort the
140 transfer and return CURLE_WRITE_ERROR.
141
142 From 7.18.0, the function can return CURL_WRITEFUNC_PAUSE which
143 then will cause writing to this connection to become paused. See
144 curl_easy_pause(3) for further details.
145
146 This function may be called with zero bytes data if the trans‐
147 ferred file is empty.
148
149 Set this option to NULL to get the internal default function.
150 The internal default function will write the data to the FILE *
151 given with CURLOPT_WRITEDATA.
152
153 Set the stream argument with the CURLOPT_WRITEDATA option.
154
155 The callback function will be passed as much data as possible in
156 all invokes, but you cannot possibly make any assumptions. It
157 may be one byte, it may be thousands. The maximum amount of data
158 that can be passed to the write callback is defined in the
159 curl.h header file: CURL_MAX_WRITE_SIZE.
160
161 CURLOPT_WRITEDATA
162 Data pointer to pass to the file write function. If you use the
163 CURLOPT_WRITEFUNCTION option, this is the pointer you'll get as
164 input. If you don't use a callback, you must pass a 'FILE *' as
165 libcurl will pass this to fwrite() when writing data.
166
167 The internal CURLOPT_WRITEFUNCTION will write the data to the
168 FILE * given with this option, or to stdout if this option
169 hasn't been set.
170
171 If you're using libcurl as a win32 DLL, you MUST use the CUR‐
172 LOPT_WRITEFUNCTION if you set this option or you will experience
173 crashes.
174
175 This option is also known with the older name CURLOPT_FILE, the
176 name CURLOPT_WRITEDATA was introduced in 7.9.7.
177
178 CURLOPT_READFUNCTION
179 Function pointer that should match the following prototype:
180 size_t function( void *ptr, size_t size, size_t nmemb, void
181 *stream); This function gets called by libcurl as soon as it
182 needs to read data in order to send it to the peer. The data
183 area pointed at by the pointer ptr may be filled with at most
184 size multiplied with nmemb number of bytes. Your function must
185 return the actual number of bytes that you stored in that memory
186 area. Returning 0 will signal end-of-file to the library and
187 cause it to stop the current transfer.
188
189 If you stop the current transfer by returning 0 "pre-maturely"
190 (i.e before the server expected it, like when you've said you
191 will upload N bytes and you upload less than N bytes), you may
192 experience that the server "hangs" waiting for the rest of the
193 data that won't come.
194
195 The read callback may return CURL_READFUNC_ABORT to stop the
196 current operation immediately, resulting in a
197 CURLE_ABORTED_BY_CALLBACK error code from the transfer (Added in
198 7.12.1)
199
200 From 7.18.0, the function can return CURL_READFUNC_PAUSE which
201 then will cause reading from this connection to become paused.
202 See curl_easy_pause(3) for further details.
203
204 If you set the callback pointer to NULL, or don't set it at all,
205 the default internal read function will be used. It is simply
206 doing an fread() on the FILE * stream set with CURLOPT_READDATA.
207
208 CURLOPT_READDATA
209 Data pointer to pass to the file read function. If you use the
210 CURLOPT_READFUNCTION option, this is the pointer you'll get as
211 input. If you don't specify a read callback but instead rely on
212 the default internal read function, this data must be a valid
213 readable FILE *.
214
215 If you're using libcurl as a win32 DLL, you MUST use a CUR‐
216 LOPT_READFUNCTION if you set this option.
217
218 This option was also known by the older name CURLOPT_INFILE, the
219 name CURLOPT_READDATA was introduced in 7.9.7.
220
221 CURLOPT_IOCTLFUNCTION
222 Function pointer that should match the curl_ioctl_callback pro‐
223 totype found in <curl/curl.h>. This function gets called by
224 libcurl when something special I/O-related needs to be done that
225 the library can't do by itself. For now, rewinding the read data
226 stream is the only action it can request. The rewinding of the
227 read data stream may be necessary when doing a HTTP PUT or POST
228 with a multi-pass authentication method. (Option added in
229 7.12.3).
230
231 Use CURLOPT_SEEKFUNCTION instead to provide seeking!
232
233 CURLOPT_IOCTLDATA
234 Pass a pointer that will be untouched by libcurl and passed as
235 the 3rd argument in the ioctl callback set with CURLOPT_IOCTL‐
236 FUNCTION. (Option added in 7.12.3)
237
238 CURLOPT_SEEKFUNCTION
239 Function pointer that should match the following prototype: int
240 function(void *instream, curl_off_t offset, int origin); This
241 function gets called by libcurl to seek to a certain position in
242 the input stream and can be used to fast forward a file in a
243 resumed upload (instead of reading all uploaded bytes with the
244 normal read function/callback). It is also called to rewind a
245 stream when doing a HTTP PUT or POST with a multi-pass authenti‐
246 cation method. The function shall work like "fseek" or "lseek"
247 and accepted SEEK_SET, SEEK_CUR and SEEK_END as argument for
248 origin, although (in 7.18.0) libcurl only passes SEEK_SET. The
249 callback must return 0 (CURL_SEEKFUNC_OK) on success, 1
250 (CURL_SEEKFUNC_FAIL) to cause the upload operation to fail or 2
251 (CURL_SEEKFUNC_CANTSEEK) to indicate that while the seek failed,
252 libcurl is free to work around the problem if possible. The lat‐
253 ter can sometimes be done by instead reading from the input or
254 similar.
255
256 If you forward the input arguments directly to "fseek" or
257 "lseek", note that the data type for offset is not the same as
258 defined for curl_off_t on many systems! (Option added in 7.18.0)
259
260 CURLOPT_SEEKDATA
261 Data pointer to pass to the file read function. If you use the
262 CURLOPT_SEEKFUNCTION option, this is the pointer you'll get as
263 input. If you don't specify a seek callback, NULL is passed.
264 (Option added in 7.18.0)
265
266 CURLOPT_SOCKOPTFUNCTION
267 Function pointer that should match the curl_sockopt_callback
268 prototype found in <curl/curl.h>. This function gets called by
269 libcurl after the socket() call but before the connect() call.
270 The callback's purpose argument identifies the exact purpose for
271 this particular socket, and currently only one value is sup‐
272 ported: CURLSOCKTYPE_IPCXN for the primary connection (meaning
273 the control connection in the FTP case). Future versions of
274 libcurl may support more purposes. It passes the newly created
275 socket descriptor so additional setsockopt() calls can be done
276 at the user's discretion. Return 0 (zero) from the callback on
277 success. Return 1 from the callback function to signal an unre‐
278 coverable error to the library and it will close the socket and
279 return CURLE_COULDNT_CONNECT. (Option added in 7.15.6.)
280
281 CURLOPT_SOCKOPTDATA
282 Pass a pointer that will be untouched by libcurl and passed as
283 the first argument in the sockopt callback set with CUR‐
284 LOPT_SOCKOPTFUNCTION. (Option added in 7.15.6.)
285
286 CURLOPT_OPENSOCKETFUNCTION
287 Function pointer that should match the curl_opensocket_callback
288 prototype found in <curl/curl.h>. This function gets called by
289 libcurl instead of the socket(2) call. The callback's purpose
290 argument identifies the exact purpose for this particular
291 socket, and currently only one value is supported: CURLSOCK‐
292 TYPE_IPCXN for the primary connection (meaning the control con‐
293 nection in the FTP case). Future versions of libcurl may support
294 more purposes. It passes the resolved peer address as a address
295 argument so the callback can modify the address or refuse to
296 connect at all. The callback function should return the socket
297 or CURL_SOCKET_BAD in case no connection should be established
298 or any error detected. Any additional setsockopt(2) calls can be
299 done on the socket at the user's discretion. CURL_SOCKET_BAD
300 return value from the callback function will signal an unrecov‐
301 erable error to the library and it will return
302 CURLE_COULDNT_CONNECT. This return code can be used for IP
303 address blacklisting. The default behavior is:
304 return socket(addr->family, addr->socktype, addr->protocol);
305 (Option added in 7.17.1.)
306
307 CURLOPT_OPENSOCKETDATA
308 Pass a pointer that will be untouched by libcurl and passed as
309 the first argument in the opensocket callback set with CUR‐
310 LOPT_OPENSOCKETFUNCTION. (Option added in 7.17.1.)
311
312 CURLOPT_PROGRESSFUNCTION
313 Function pointer that should match the curl_progress_callback
314 prototype found in <curl/curl.h>. This function gets called by
315 libcurl instead of its internal equivalent with a frequent
316 interval during operation (roughly once per second or sooner) no
317 matter if data is being transfered or not. Unknown/unused argu‐
318 ment values passed to the callback will be set to zero (like if
319 you only download data, the upload size will remain 0). Return‐
320 ing a non-zero value from this callback will cause libcurl to
321 abort the transfer and return CURLE_ABORTED_BY_CALLBACK.
322
323 If you transfer data with the multi interface, this function
324 will not be called during periods of idleness unless you call
325 the appropriate libcurl function that performs transfers.
326
327 CURLOPT_NOPROGRESS must be set to 0 to make this function actu‐
328 ally get called.
329
330 CURLOPT_PROGRESSDATA
331 Pass a pointer that will be untouched by libcurl and passed as
332 the first argument in the progress callback set with CUR‐
333 LOPT_PROGRESSFUNCTION.
334
335 CURLOPT_HEADERFUNCTION
336 Function pointer that should match the following prototype:
337 size_t function( void *ptr, size_t size, size_t nmemb, void
338 *stream);. This function gets called by libcurl as soon as it
339 has received header data. The header callback will be called
340 once for each header and only complete header lines are passed
341 on to the callback. Parsing headers should be easy enough using
342 this. The size of the data pointed to by ptr is size multiplied
343 with nmemb. Do not assume that the header line is zero termi‐
344 nated! The pointer named stream is the one you set with the CUR‐
345 LOPT_WRITEHEADER option. The callback function must return the
346 number of bytes actually taken care of. If that amount differs
347 from the amount passed to your function, it'll signal an error
348 to the library. This will abort the transfer and return
349 CURL_WRITE_ERROR.
350
351 If this option is not set, or if it is set to NULL, but CUR‐
352 LOPT_HEADERDATA (CURLOPT_WRITEHEADER) is set to anything but
353 NULL, the function used to accept response data will be used
354 instead. That is, it will be the function specified with CUR‐
355 LOPT_WRITEFUNCTION, or if it is not specified or NULL - the
356 default, stream-writing function.
357
358 It's important to note that the callback will be invoked for the
359 headers of all responses received after initiating a request and
360 not just the final response. This includes all responses which
361 occur during authentication negotiation. If you need to operate
362 on only the headers from the final response, you will need to
363 collect headers in the callback yourself and use HTTP status
364 lines, for example, to delimit response boundaries.
365
366 Since 7.14.1: When a server sends a chunked encoded transfer, it
367 may contain a trailer. That trailer is identical to a HTTP
368 header and if such a trailer is received it is passed to the
369 application using this callback as well. There are several ways
370 to detect it being a trailer and not an ordinary header: 1) it
371 comes after the response-body. 2) it comes after the final
372 header line (CR LF) 3) a Trailer: header among the response-
373 headers mention what header to expect in the trailer.
374
375 CURLOPT_WRITEHEADER
376 (This option is also known as CURLOPT_HEADERDATA) Pass a pointer
377 to be used to write the header part of the received data to. If
378 you don't use your own callback to take care of the writing,
379 this must be a valid FILE *. See also the CURLOPT_HEADERFUNCTION
380 option above on how to set a custom get-all-headers callback.
381
382 CURLOPT_DEBUGFUNCTION
383 Function pointer that should match the following prototype: int
384 curl_debug_callback (CURL *, curl_infotype, char *, size_t, void
385 *); CURLOPT_DEBUGFUNCTION replaces the standard debug function
386 used when CURLOPT_VERBOSE is in effect. This callback receives
387 debug information, as specified with the curl_infotype argument.
388 This function must return 0. The data pointed to by the char *
389 passed to this function WILL NOT be zero terminated, but will be
390 exactly of the size as told by the size_t argument.
391
392 Available curl_infotype values:
393
394 CURLINFO_TEXT
395 The data is informational text.
396
397 CURLINFO_HEADER_IN
398 The data is header (or header-like) data received from
399 the peer.
400
401 CURLINFO_HEADER_OUT
402 The data is header (or header-like) data sent to the
403 peer.
404
405 CURLINFO_DATA_IN
406 The data is protocol data received from the peer.
407
408 CURLINFO_DATA_OUT
409 The data is protocol data sent to the peer.
410
411 CURLOPT_DEBUGDATA
412 Pass a pointer to whatever you want passed in to your CUR‐
413 LOPT_DEBUGFUNCTION in the last void * argument. This pointer is
414 not used by libcurl, it is only passed to the callback.
415
416 CURLOPT_SSL_CTX_FUNCTION
417 This option does only function for libcurl powered by OpenSSL.
418 If libcurl was built against another SSL library, this function‐
419 ality is absent.
420
421 Function pointer that should match the following prototype:
422 CURLcode sslctxfun(CURL *curl, void *sslctx, void *parm); This
423 function gets called by libcurl just before the initialization
424 of an SSL connection after having processed all other SSL
425 related options to give a last chance to an application to mod‐
426 ify the behaviour of openssl's ssl initialization. The sslctx
427 parameter is actually a pointer to an openssl SSL_CTX. If an
428 error is returned no attempt to establish a connection is made
429 and the perform operation will return the error code from this
430 callback function. Set the parm argument with the CUR‐
431 LOPT_SSL_CTX_DATA option. This option was introduced in 7.11.0.
432
433 This function will get called on all new connections made to a
434 server, during the SSL negotiation. The SSL_CTX pointer will be
435 a new one every time.
436
437 To use this properly, a non-trivial amount of knowledge of the
438 openssl libraries is necessary. For example, using this function
439 allows you to use openssl callbacks to add additional validation
440 code for certificates, and even to change the actual URI of an
441 HTTPS request (example used in the lib509 test case). See also
442 the example section for a replacement of the key, certificate
443 and trust file settings.
444
445 CURLOPT_SSL_CTX_DATA
446 Data pointer to pass to the ssl context callback set by the
447 option CURLOPT_SSL_CTX_FUNCTION, this is the pointer you'll get
448 as third parameter, otherwise NULL. (Added in 7.11.0)
449
450 CURLOPT_CONV_TO_NETWORK_FUNCTION
451
452 CURLOPT_CONV_FROM_NETWORK_FUNCTION
453
454 CURLOPT_CONV_FROM_UTF8_FUNCTION
455 Function pointers that should match the following prototype:
456 CURLcode function(char *ptr, size_t length);
457
458 These three options apply to non-ASCII platforms only. They are
459 available only if CURL_DOES_CONVERSIONS was defined when libcurl
460 was built. When this is the case, curl_version_info(3) will
461 return the CURL_VERSION_CONV feature bit set.
462
463 The data to be converted is in a buffer pointed to by the ptr
464 parameter. The amount of data to convert is indicated by the
465 length parameter. The converted data overlays the input data in
466 the buffer pointed to by the ptr parameter. CURLE_OK should be
467 returned upon successful conversion. A CURLcode return value
468 defined by curl.h, such as CURLE_CONV_FAILED, should be returned
469 if an error was encountered.
470
471 CURLOPT_CONV_TO_NETWORK_FUNCTION and CURLOPT_CONV_FROM_NET‐
472 WORK_FUNCTION convert between the host encoding and the network
473 encoding. They are used when commands or ASCII data are
474 sent/received over the network.
475
476 CURLOPT_CONV_FROM_UTF8_FUNCTION is called to convert from UTF8
477 into the host encoding. It is required only for SSL processing.
478
479 If you set a callback pointer to NULL, or don't set it at all,
480 the built-in libcurl iconv functions will be used. If
481 HAVE_ICONV was not defined when libcurl was built, and no call‐
482 back has been established, conversion will return the
483 CURLE_CONV_REQD error code.
484
485 If HAVE_ICONV is defined, CURL_ICONV_CODESET_OF_HOST must also
486 be defined. For example:
487
488 #define CURL_ICONV_CODESET_OF_HOST "IBM-1047"
489
490 The iconv code in libcurl will default the network and UTF8
491 codeset names as follows:
492
493 #define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1"
494
495 #define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8"
496
497 You will need to override these definitions if they are differ‐
498 ent on your system.
499
500 CURLOPT_INTERLEAVEFUNCTION
501 Function pointer that should match the following prototype:
502 size_t function( void *ptr, size_t size, size_t nmemb, void
503 *stream). This function gets called by libcurl as soon as it has
504 received interleaved RTP data. This function gets called for
505 each $ block and therefore contains exactly one upper-layer pro‐
506 tocol unit (e.g. one RTP packet). Curl writes the interleaved
507 header as well as the included data for each call. The first
508 byte is always an ASCII dollar sign. The dollar sign is followed
509 by a one byte channel identifier and then a 2 byte integer
510 length in network byte order. See RFC 2326 Section 10.12 for
511 more information on how RTP interleaving behaves. If unset or
512 set to NULL, curl will use the default write function.
513
514 Interleaved RTP poses some challeneges for the client applica‐
515 tion. Since the stream data is sharing the RTSP control connec‐
516 tion, it is critical to service the RTP in a timely fashion. If
517 the RTP data is not handled quickly, subsequent response pro‐
518 cessing may become unreasonably delayed and the connection may
519 close. The application may use CURL_RTSPREQ_RECEIVE to service
520 RTP data when no requests are desired. If the application makes
521 a request, (e.g. CURL_RTSPREQ_PAUSE) then the response handler
522 will process any pending RTP data before marking the request as
523 finished. (Added in 7.20.0)
524
525 CURLOPT_INTERLEAVEDATA
526 This is the stream that will be passed to CURLOPT_INTERLEAVE‐
527 FUNCTION when interleaved RTP data is received. (Added in
528 7.20.0)
529
530 CURLOPT_CHUNK_BGN_FUNCTION
531 Function pointer that should match the following prototype: long
532 function (const void *transfer_info, void *ptr, int remains).
533 This function gets called by libcurl before a part of the stream
534 is going to be transferred (if the transfer supports chunks).
535
536 This callback makes sense only when using the CURLOPT_WILDCARD‐
537 MATCH option for now.
538
539 The target of transfer_info parameter is a "feature depended"
540 structure. For the FTP wildcard download, the target is
541 curl_fileinfo structure (see curl/curl.h). The parameter ptr is
542 a pointer given by CURLOPT_CHUNK_DATA. The parameter remains
543 contains number of chunks remaining per the transfer. If the
544 feature is not available, the parameter has zero value.
545
546 Return CURL_CHUNK_BGN_FUNC_OK if everything is fine,
547 CURL_CHUNK_BGN_FUNC_SKIP if you want to skip the concrete chunk
548 or CURL_CHUNK_BGN_FUNC_FAIL to tell libcurl to stop if some
549 error occurred. (This was added in 7.21.0)
550
551 CURLOPT_CHUNK_END_FUNCTION
552 Function pointer that should match the following prototype: long
553 function(void *ptr). This function gets called by libcurl as
554 soon as a part of the stream has been transferred (or skipped).
555
556 Return CURL_CHUNK_END_FUNC_OK if everything is fine or
557 CURL_CHUNK_END_FUNC_FAIL to tell the lib to stop if some error
558 occurred. (This was added in 7.21.0)
559
560 CURLOPT_CHUNK_DATA
561 Pass a pointer that will be untouched by libcurl and passed as
562 the ptr argument to the CURL_CHUNK_BGN_FUNTION and
563 CURL_CHUNK_END_FUNTION. (This was added in 7.21.0)
564
565 CURLOPT_FNMATCH_FUNCTION
566 Function pointer that should match int function(void *ptr, const
567 char *pattern, const char *string) prototype (see curl/curl.h).
568 It is used internally for the wildcard matching feature.
569
570 Return CURL_FNMATCHFUNC_MATCH if pattern matches the string,
571 CURL_FNMATCHFUNC_NOMATCH if not or CURL_FNMATCHFUNC_FAIL if an
572 error occurred. (This was added in 7.21.0)
573
574 CURLOPT_FNMATCH_DATA
575 Pass a pointer that will be untouched by libcurl and passed as
576 the ptr argument to the CURL_FNMATCH_FUNCTION. (This was added
577 in 7.21.0)
578
580 CURLOPT_ERRORBUFFER
581 Pass a char * to a buffer that the libcurl may store human read‐
582 able error messages in. This may be more helpful than just the
583 return code from curl_easy_perform. The buffer must be at least
584 CURL_ERROR_SIZE big. Although this argument is a 'char *', it
585 does not describe an input string. Therefore the (probably
586 undefined) contents of the buffer is NOT copied by the library.
587 You should keep the associated storage available until libcurl
588 no longer needs it. Failing to do so will cause very odd behav‐
589 ior or even crashes. libcurl will need it until you call
590 curl_easy_cleanup(3) or you set the same option again to use a
591 different pointer.
592
593 Use CURLOPT_VERBOSE and CURLOPT_DEBUGFUNCTION to better
594 debug/trace why errors happen.
595
596 If the library does not return an error, the buffer may not have
597 been touched. Do not rely on the contents in those cases.
598
599
600 CURLOPT_STDERR
601 Pass a FILE * as parameter. Tell libcurl to use this stream
602 instead of stderr when showing the progress meter and displaying
603 CURLOPT_VERBOSE data.
604
605 CURLOPT_FAILONERROR
606 A parameter set to 1 tells the library to fail silently if the
607 HTTP code returned is equal to or larger than 400. The default
608 action would be to return the page normally, ignoring that code.
609
610 This method is not fail-safe and there are occasions where non-
611 successful response codes will slip through, especially when
612 authentication is involved (response codes 401 and 407).
613
614 You might get some amounts of headers transferred before this
615 situation is detected, like when a "100-continue" is received as
616 a response to a POST/PUT and a 401 or 407 is received immedi‐
617 ately afterwards.
618
620 CURLOPT_URL
621 The actual URL to deal with. The parameter should be a char * to
622 a zero terminated string.
623
624 If the given URL lacks the protocol part ("http://" or "ftp://"
625 etc), it will attempt to guess which protocol to use based on
626 the given host name. If the given protocol of the set URL is not
627 supported, libcurl will return on error (CURLE_UNSUPPORTED_PRO‐
628 TOCOL) when you call curl_easy_perform(3) or curl_multi_per‐
629 form(3). Use curl_version_info(3) for detailed info on which
630 protocols are supported.
631
632 The string given to CURLOPT_URL must be url-encoded and follow
633 RFC 2396 (http://curl.haxx.se/rfc/rfc2396.txt).
634
635 Starting with version 7.20.0, the fragment part of the URI will
636 not be send as part of the path, which was the case previously.
637
638 CURLOPT_URL is the only option that must be set before
639 curl_easy_perform(3) is called.
640
641 CURLOPT_PROTOCOLS can be used to limit what protocols libcurl
642 will use for this transfer, independent of what libcurl has been
643 compiled to support. That may be useful if you accept the URL
644 from an external source and want to limit the accessibility.
645
646 CURLOPT_PROTOCOLS
647 Pass a long that holds a bitmask of CURLPROTO_* defines. If
648 used, this bitmask limits what protocols libcurl may use in the
649 transfer. This allows you to have a libcurl built to support a
650 wide range of protocols but still limit specific transfers to
651 only be allowed to use a subset of them. By default libcurl will
652 accept all protocols it supports. See also CURLOPT_REDIR_PROTO‐
653 COLS. (Added in 7.19.4)
654
655 CURLOPT_REDIR_PROTOCOLS
656 Pass a long that holds a bitmask of CURLPROTO_* defines. If
657 used, this bitmask limits what protocols libcurl may use in a
658 transfer that it follows to in a redirect when CURLOPT_FOLLOWLO‐
659 CATION is enabled. This allows you to limit specific transfers
660 to only be allowed to use a subset of protocols in redirections.
661 By default libcurl will allow all protocols except for FILE and
662 SCP. This is a difference compared to pre-7.19.4 versions which
663 unconditionally would follow to all protocols supported. (Added
664 in 7.19.4)
665
666 CURLOPT_PROXY
667 Set HTTP proxy to use. The parameter should be a char * to a
668 zero terminated string holding the host name or dotted IP
669 address. To specify port number in this string, append :[port]
670 to the end of the host name. The proxy string may be prefixed
671 with [protocol]:// since any such prefix will be ignored. The
672 proxy's port number may optionally be specified with the sepa‐
673 rate option. If not specified, libcurl will default to using
674 port 1080 for proxies. CURLOPT_PROXYPORT.
675
676 When you tell the library to use an HTTP proxy, libcurl will
677 transparently convert operations to HTTP even if you specify an
678 FTP URL etc. This may have an impact on what other features of
679 the library you can use, such as CURLOPT_QUOTE and similar FTP
680 specifics that don't work unless you tunnel through the HTTP
681 proxy. Such tunneling is activated with CURLOPT_HTTPPROXYTUNNEL.
682
683 libcurl respects the environment variables http_proxy,
684 ftp_proxy, all_proxy etc, if any of those are set. The CUR‐
685 LOPT_PROXY option does however override any possibly set envi‐
686 ronment variables.
687
688 Setting the proxy string to "" (an empty string) will explicitly
689 disable the use of a proxy, even if there is an environment
690 variable set for it.
691
692 Since 7.14.1, the proxy host string given in environment vari‐
693 ables can be specified the exact same way as the proxy can be
694 set with CURLOPT_PROXY, include protocol prefix (http://) and
695 embedded user + password.
696
697 CURLOPT_PROXYPORT
698 Pass a long with this option to set the proxy port to connect to
699 unless it is specified in the proxy string CURLOPT_PROXY.
700
701 CURLOPT_PROXYTYPE
702 Pass a long with this option to set type of the proxy. Available
703 options for this are CURLPROXY_HTTP, CURLPROXY_HTTP_1_0 (added
704 in 7.19.4), CURLPROXY_SOCKS4 (added in 7.15.2), CURL‐
705 PROXY_SOCKS5, CURLPROXY_SOCKS4A (added in 7.18.0) and CURL‐
706 PROXY_SOCKS5_HOSTNAME (added in 7.18.0). The HTTP type is
707 default. (Added in 7.10)
708
709 CURLOPT_NOPROXY
710 Pass a pointer to a zero terminated string. The should be a
711 comma- separated list of hosts which do not use a proxy, if one
712 is specified. The only wildcard is a single * character, which
713 matches all hosts, and effectively disables the proxy. Each name
714 in this list is matched as either a domain which contains the
715 hostname, or the hostname itself. For example, local.com would
716 match local.com, local.com:80, and www.local.com, but not
717 www.notlocal.com. (Added in 7.19.4)
718
719 CURLOPT_HTTPPROXYTUNNEL
720 Set the parameter to 1 to make the library tunnel all operations
721 through a given HTTP proxy. There is a big difference between
722 using a proxy and to tunnel through it. If you don't know what
723 this means, you probably don't want this tunneling option.
724
725 CURLOPT_SOCKS5_GSSAPI_SERVICE
726 Pass a char * as parameter to a string holding the name of the
727 service. The default service name for a SOCKS5 server is
728 rcmd/server-fqdn. This option allows you to change it. (Added in
729 7.19.4)
730
731 CURLOPT_SOCKS5_GSSAPI_NEC
732 Pass a long set to 1 to enable or 0 to disable. As part of the
733 gssapi negotiation a protection mode is negotiated. The rfc1961
734 says in section 4.3/4.4 it should be protected, but the NEC ref‐
735 erence implementation does not. If enabled, this option allows
736 the unprotected exchange of the protection mode negotiation.
737 (Added in 7.19.4).
738
739 CURLOPT_INTERFACE
740 Pass a char * as parameter. This sets the interface name to use
741 as outgoing network interface. The name can be an interface
742 name, an IP address, or a host name.
743
744 CURLOPT_LOCALPORT
745 Pass a long. This sets the local port number of the socket used
746 for connection. This can be used in combination with CUR‐
747 LOPT_INTERFACE and you are recommended to use CURLOPT_LOCALPOR‐
748 TRANGE as well when this is set. Valid port numbers are 1 -
749 65535. (Added in 7.15.2)
750
751 CURLOPT_LOCALPORTRANGE
752 Pass a long. This is the number of attempts libcurl should make
753 to find a working local port number. It starts with the given
754 CURLOPT_LOCALPORT and adds one to the number for each retry.
755 Setting this to 1 or below will make libcurl do only one try for
756 the exact port number. Port numbers by nature are scarce
757 resources that will be busy at times so setting this value to
758 something too low might cause unnecessary connection setup fail‐
759 ures. (Added in 7.15.2)
760
761 CURLOPT_DNS_CACHE_TIMEOUT
762 Pass a long, this sets the timeout in seconds. Name resolves
763 will be kept in memory for this number of seconds. Set to zero
764 to completely disable caching, or set to -1 to make the cached
765 entries remain forever. By default, libcurl caches this info for
766 60 seconds.
767
768 The name resolve functions of various libc implementations don't
769 re-read name server information unless explicitly told so (for
770 example, by calling res_init(3)). This may cause libcurl to keep
771 using the older server even if DHCP has updated the server info,
772 and this may look like a DNS cache issue to the casual libcurl-
773 app user.
774
775 CURLOPT_DNS_USE_GLOBAL_CACHE
776 Pass a long. If the value is 1, it tells curl to use a global
777 DNS cache that will survive between easy handle creations and
778 deletions. This is not thread-safe and this will use a global
779 variable.
780
781 WARNING: this option is considered obsolete. Stop using it.
782 Switch over to using the share interface instead! See CUR‐
783 LOPT_SHARE and curl_share_init(3).
784
785 CURLOPT_BUFFERSIZE
786 Pass a long specifying your preferred size (in bytes) for the
787 receive buffer in libcurl. The main point of this would be that
788 the write callback gets called more often and with smaller
789 chunks. This is just treated as a request, not an order. You
790 cannot be guaranteed to actually get the given size. (Added in
791 7.10)
792
793 This size is by default set as big as possible
794 (CURL_MAX_WRITE_SIZE), so it only makes sense to use this option
795 if you want it smaller.
796
797 CURLOPT_PORT
798 Pass a long specifying what remote port number to connect to,
799 instead of the one specified in the URL or the default port for
800 the used protocol.
801
802 CURLOPT_TCP_NODELAY
803 Pass a long specifying whether the TCP_NODELAY option should be
804 set or cleared (1 = set, 0 = clear). The option is cleared by
805 default. This will have no effect after the connection has been
806 established.
807
808 Setting this option will disable TCP's Nagle algorithm. The pur‐
809 pose of this algorithm is to try to minimize the number of small
810 packets on the network (where "small packets" means TCP segments
811 less than the Maximum Segment Size (MSS) for the network).
812
813 Maximizing the amount of data sent per TCP segment is good
814 because it amortizes the overhead of the send. However, in some
815 cases (most notably telnet or rlogin) small segments may need to
816 be sent without delay. This is less efficient than sending
817 larger amounts of data at a time, and can contribute to conges‐
818 tion on the network if overdone.
819
820 CURLOPT_ADDRESS_SCOPE
821 Pass a long specifying the scope_id value to use when connecting
822 to IPv6 link-local or site-local addresses. (Added in 7.19.0)
823
825 CURLOPT_NETRC
826 This parameter controls the preference of libcurl between using
827 user names and passwords from your ~/.netrc file, relative to
828 user names and passwords in the URL supplied with CURLOPT_URL.
829
830 libcurl uses a user name (and supplied or prompted password)
831 supplied with CURLOPT_USERPWD in preference to any of the
832 options controlled by this parameter.
833
834 Pass a long, set to one of the values described below.
835
836 CURL_NETRC_OPTIONAL
837 The use of your ~/.netrc file is optional, and informa‐
838 tion in the URL is to be preferred. The file will be
839 scanned for the host and user name (to find the password
840 only) or for the host only, to find the first user name
841 and password after that machine, which ever information
842 is not specified in the URL.
843
844 Undefined values of the option will have this effect.
845
846 CURL_NETRC_IGNORED
847 The library will ignore the file and use only the infor‐
848 mation in the URL.
849
850 This is the default.
851
852 CURL_NETRC_REQUIRED
853 This value tells the library that use of the file is
854 required, to ignore the information in the URL, and to
855 search the file for the host only.
856 Only machine name, user name and password are taken into account (init
857 macros and similar things aren't supported).
858
859 libcurl does not verify that the file has the correct properties set
860 (as the standard Unix ftp client does). It should only be readable by
861 user.
862
863 CURLOPT_NETRC_FILE
864 Pass a char * as parameter, pointing to a zero terminated string
865 containing the full path name to the file you want libcurl to
866 use as .netrc file. If this option is omitted, and CURLOPT_NETRC
867 is set, libcurl will attempt to find a .netrc file in the cur‐
868 rent user's home directory. (Added in 7.10.9)
869
870 CURLOPT_USERPWD
871 Pass a char * as parameter, which should be [user name]:[pass‐
872 word] to use for the connection. Use CURLOPT_HTTPAUTH to decide
873 the authentication method.
874
875 When using NTLM, you can set the domain by prepending it to the
876 user name and separating the domain and name with a forward (/)
877 or backward slash (\). Like this: "domain/user:password" or
878 "domain\user:password". Some HTTP servers (on Windows) support
879 this style even for Basic authentication.
880
881 When using HTTP and CURLOPT_FOLLOWLOCATION, libcurl might per‐
882 form several requests to possibly different hosts. libcurl will
883 only send this user and password information to hosts using the
884 initial host name (unless CURLOPT_UNRESTRICTED_AUTH is set), so
885 if libcurl follows locations to other hosts it will not send the
886 user and password to those. This is enforced to prevent acciden‐
887 tal information leakage.
888
889 CURLOPT_PROXYUSERPWD
890 Pass a char * as parameter, which should be [user name]:[pass‐
891 word] to use for the connection to the HTTP proxy. Use CUR‐
892 LOPT_PROXYAUTH to decide the authentication method.
893
894 CURLOPT_USERNAME
895 Pass a char * as parameter, which should be pointing to the zero
896 terminated user name to use for the transfer.
897
898 CURLOPT_USERNAME sets the user name to be used in protocol
899 authentication. You should not use this option together with the
900 (older) CURLOPT_USERPWD option.
901
902 In order to specify the password to be used in conjunction with
903 the user name use the CURLOPT_PASSWORD option. (Added in
904 7.19.1)
905
906 CURLOPT_PASSWORD
907 Pass a char * as parameter, which should be pointing to the zero
908 terminated password to use for the transfer.
909
910 The CURLOPT_PASSWORD option should be used in conjunction with
911 the CURLOPT_USERNAME option. (Added in 7.19.1)
912
913 CURLOPT_PROXYUSERNAME
914 Pass a char * as parameter, which should be pointing to the zero
915 terminated user name to use for the transfer while connecting to
916 Proxy.
917
918 The CURLOPT_PROXYUSERNAME option should be used in same way as
919 the CURLOPT_PROXYUSERPWD is used. In comparison to CUR‐
920 LOPT_PROXYUSERPWD the CURLOPT_PROXYUSERNAME allows the username
921 to contain a colon, like in the following example:
922 "sip:user@example.com". The CURLOPT_PROXYUSERNAME option is an
923 alternative way to set the user name while connecting to Proxy.
924 There is no meaning to use it together with the CURLOPT_PROX‐
925 YUSERPWD option.
926
927 In order to specify the password to be used in conjunction with
928 the user name use the CURLOPT_PROXYPASSWORD option. (Added in
929 7.19.1)
930
931 CURLOPT_PROXYPASSWORD
932 Pass a char * as parameter, which should be pointing to the zero
933 terminated password to use for the transfer while connecting to
934 Proxy.
935
936 The CURLOPT_PROXYPASSWORD option should be used in conjunction
937 with the CURLOPT_PROXYUSERNAME option. (Added in 7.19.1)
938
939 CURLOPT_HTTPAUTH
940 Pass a long as parameter, which is set to a bitmask, to tell
941 libcurl which authentication method(s) you want it to use. The
942 available bits are listed below. If more than one bit is set,
943 libcurl will first query the site to see which authentication
944 methods it supports and then pick the best one you allow it to
945 use. For some methods, this will induce an extra network round-
946 trip. Set the actual name and password with the CURLOPT_USERPWD
947 option or with the CURLOPT_USERNAME and the CURLOPT_USERPASSWORD
948 options. (Added in 7.10.6)
949
950 CURLAUTH_BASIC
951 HTTP Basic authentication. This is the default choice,
952 and the only method that is in wide-spread use and sup‐
953 ported virtually everywhere. This sends the user name and
954 password over the network in plain text, easily captured
955 by others.
956
957 CURLAUTH_DIGEST
958 HTTP Digest authentication. Digest authentication is
959 defined in RFC2617 and is a more secure way to do authen‐
960 tication over public networks than the regular old-fash‐
961 ioned Basic method.
962
963 CURLAUTH_DIGEST_IE
964 HTTP Digest authentication with an IE flavor. Digest
965 authentication is defined in RFC2617 and is a more secure
966 way to do authentication over public networks than the
967 regular old-fashioned Basic method. The IE flavor is sim‐
968 ply that libcurl will use a special "quirk" that IE is
969 known to have used before version 7 and that some servers
970 require the client to use. (This define was added in
971 7.19.3)
972
973 CURLAUTH_GSSNEGOTIATE
974 HTTP GSS-Negotiate authentication. The GSS-Negotiate
975 (also known as plain "Negotiate") method was designed by
976 Microsoft and is used in their web applications. It is
977 primarily meant as a support for Kerberos5 authentication
978 but may also be used along with other authentication
979 methods. For more information see IETF draft draft-
980 brezak-spnego-http-04.txt.
981
982 You need to build libcurl with a suitable GSS-API library
983 for this to work.
984
985 CURLAUTH_NTLM
986 HTTP NTLM authentication. A proprietary protocol invented
987 and used by Microsoft. It uses a challenge-response and
988 hash concept similar to Digest, to prevent the password
989 from being eavesdropped.
990
991 You need to build libcurl with OpenSSL support for this
992 option to work, or build libcurl on Windows.
993
994 CURLAUTH_ANY
995 This is a convenience macro that sets all bits and thus
996 makes libcurl pick any it finds suitable. libcurl will
997 automatically select the one it finds most secure.
998
999 CURLAUTH_ANYSAFE
1000 This is a convenience macro that sets all bits except
1001 Basic and thus makes libcurl pick any it finds suitable.
1002 libcurl will automatically select the one it finds most
1003 secure.
1004
1005 CURLOPT_PROXYAUTH
1006 Pass a long as parameter, which is set to a bitmask, to tell
1007 libcurl which authentication method(s) you want it to use for
1008 your proxy authentication. If more than one bit is set, libcurl
1009 will first query the site to see what authentication methods it
1010 supports and then pick the best one you allow it to use. For
1011 some methods, this will induce an extra network round-trip. Set
1012 the actual name and password with the CURLOPT_PROXYUSERPWD
1013 option. The bitmask can be constructed by or'ing together the
1014 bits listed above for the CURLOPT_HTTPAUTH option. As of this
1015 writing, only Basic, Digest and NTLM work. (Added in 7.10.7)
1016
1018 CURLOPT_AUTOREFERER
1019 Pass a parameter set to 1 to enable this. When enabled, libcurl
1020 will automatically set the Referer: field in requests where it
1021 follows a Location: redirect.
1022
1023 CURLOPT_ENCODING
1024 Sets the contents of the Accept-Encoding: header sent in an HTTP
1025 request, and enables decoding of a response when a Content-
1026 Encoding: header is received. Three encodings are supported:
1027 identity, which does nothing, deflate which requests the server
1028 to compress its response using the zlib algorithm, and gzip
1029 which requests the gzip algorithm. If a zero-length string is
1030 set, then an Accept-Encoding: header containing all supported
1031 encodings is sent.
1032
1033 This is a request, not an order; the server may or may not do
1034 it. This option must be set (to any non-NULL value) or else any
1035 unsolicited encoding done by the server is ignored. See the spe‐
1036 cial file lib/README.encoding for details.
1037
1038 CURLOPT_FOLLOWLOCATION
1039 A parameter set to 1 tells the library to follow any Location:
1040 header that the server sends as part of an HTTP header.
1041
1042 This means that the library will re-send the same request on the
1043 new location and follow new Location: headers all the way until
1044 no more such headers are returned. CURLOPT_MAXREDIRS can be used
1045 to limit the number of redirects libcurl will follow.
1046
1047 Since 7.19.4, libcurl can limit what protocols it will automati‐
1048 cally follow. The accepted protocols are set with CUR‐
1049 LOPT_REDIR_PROTOCOLS and it excludes the FILE protocol by
1050 default.
1051
1052 CURLOPT_UNRESTRICTED_AUTH
1053 A parameter set to 1 tells the library it can continue to send
1054 authentication (user+password) when following locations, even
1055 when hostname changed. This option is meaningful only when set‐
1056 ting CURLOPT_FOLLOWLOCATION.
1057
1058 CURLOPT_MAXREDIRS
1059 Pass a long. The set number will be the redirection limit. If
1060 that many redirections have been followed, the next redirect
1061 will cause an error (CURLE_TOO_MANY_REDIRECTS). This option only
1062 makes sense if the CURLOPT_FOLLOWLOCATION is used at the same
1063 time. Added in 7.15.1: Setting the limit to 0 will make libcurl
1064 refuse any redirect. Set it to -1 for an infinite number of
1065 redirects (which is the default)
1066
1067 CURLOPT_POSTREDIR
1068 Pass a bitmask to control how libcurl acts on redirects after
1069 POSTs that get a 301 or 302 response back. A parameter with bit
1070 0 set (value CURL_REDIR_POST_301) tells the library to respect
1071 RFC 2616/10.3.2 and not convert POST requests into GET requests
1072 when following a 301 redirection. Setting bit 1 (value
1073 CURL_REDIR_POST_302) makes libcurl maintain the request method
1074 after a 302 redirect. CURL_REDIR_POST_ALL is a convenience
1075 define that sets both bits.
1076
1077 The non-RFC behaviour is ubiquitous in web browsers, so the
1078 library does the conversion by default to maintain consistency.
1079 However, a server may require a POST to remain a POST after such
1080 a redirection. This option is meaningful only when setting CUR‐
1081 LOPT_FOLLOWLOCATION. (Added in 7.17.1) (This option was known
1082 as CURLOPT_POST301 up to 7.19.0 as it only supported the 301 way
1083 before then)
1084
1085 CURLOPT_PUT
1086 A parameter set to 1 tells the library to use HTTP PUT to trans‐
1087 fer data. The data should be set with CURLOPT_READDATA and CUR‐
1088 LOPT_INFILESIZE.
1089
1090 This option is deprecated and starting with version 7.12.1 you
1091 should instead use CURLOPT_UPLOAD.
1092
1093 CURLOPT_POST
1094 A parameter set to 1 tells the library to do a regular HTTP
1095 post. This will also make the library use a "Content-Type:
1096 application/x-www-form-urlencoded" header. (This is by far the
1097 most commonly used POST method).
1098
1099 Use one of CURLOPT_POSTFIELDS or CURLOPT_COPYPOSTFIELDS options
1100 to specify what data to post and CURLOPT_POSTFIELDSIZE or CUR‐
1101 LOPT_POSTFIELDSIZE_LARGE to set the data size.
1102
1103 Optionally, you can provide data to POST using the CURLOPT_READ‐
1104 FUNCTION and CURLOPT_READDATA options but then you must make
1105 sure to not set CURLOPT_POSTFIELDS to anything but NULL. When
1106 providing data with a callback, you must transmit it using chun‐
1107 ked transfer-encoding or you must set the size of the data with
1108 the CURLOPT_POSTFIELDSIZE or CURLOPT_POSTFIELDSIZE_LARGE option.
1109 To enable chunked encoding, you simply pass in the appropriate
1110 Transfer-Encoding header, see the post-callback.c example.
1111
1112 You can override the default POST Content-Type: header by set‐
1113 ting your own with CURLOPT_HTTPHEADER.
1114
1115 Using POST with HTTP 1.1 implies the use of a "Expect: 100-con‐
1116 tinue" header. You can disable this header with CURLOPT_HTTP‐
1117 HEADER as usual.
1118
1119 If you use POST to a HTTP 1.1 server, you can send data without
1120 knowing the size before starting the POST if you use chunked
1121 encoding. You enable this by adding a header like "Transfer-
1122 Encoding: chunked" with CURLOPT_HTTPHEADER. With HTTP 1.0 or
1123 without chunked transfer, you must specify the size in the
1124 request.
1125
1126 When setting CURLOPT_POST to 1, it will automatically set CUR‐
1127 LOPT_NOBODY to 0 (since 7.14.1).
1128
1129 If you issue a POST request and then want to make a HEAD or GET
1130 using the same re-used handle, you must explicitly set the new
1131 request type using CURLOPT_NOBODY or CURLOPT_HTTPGET or similar.
1132
1133 CURLOPT_POSTFIELDS
1134 Pass a void * as parameter, which should be the full data to
1135 post in an HTTP POST operation. You must make sure that the data
1136 is formatted the way you want the server to receive it. libcurl
1137 will not convert or encode it for you. Most web servers will
1138 assume this data to be url-encoded.
1139
1140 The pointed data are NOT copied by the library: as a conse‐
1141 quence, they must be preserved by the calling application until
1142 the transfer finishes.
1143
1144 This POST is a normal application/x-www-form-urlencoded kind
1145 (and libcurl will set that Content-Type by default when this
1146 option is used), which is the most commonly used one by HTML
1147 forms. See also the CURLOPT_POST. Using CURLOPT_POSTFIELDS
1148 implies CURLOPT_POST.
1149
1150 If you want to do a zero-byte POST, you need to set CUR‐
1151 LOPT_POSTFIELDSIZE explicitly to zero, as simply setting CUR‐
1152 LOPT_POSTFIELDS to NULL or "" just effectively disables the
1153 sending of the specified string. libcurl will instead assume
1154 that you'll send the POST data using the read callback!
1155
1156 Using POST with HTTP 1.1 implies the use of a "Expect: 100-con‐
1157 tinue" header. You can disable this header with CURLOPT_HTTP‐
1158 HEADER as usual.
1159
1160 To make multipart/formdata posts (aka RFC2388-posts), check out
1161 the CURLOPT_HTTPPOST option.
1162
1163 CURLOPT_POSTFIELDSIZE
1164 If you want to post data to the server without letting libcurl
1165 do a strlen() to measure the data size, this option must be
1166 used. When this option is used you can post fully binary data,
1167 which otherwise is likely to fail. If this size is set to -1,
1168 the library will use strlen() to get the size.
1169
1170 CURLOPT_POSTFIELDSIZE_LARGE
1171 Pass a curl_off_t as parameter. Use this to set the size of the
1172 CURLOPT_POSTFIELDS data to prevent libcurl from doing strlen()
1173 on the data to figure out the size. This is the large file ver‐
1174 sion of the CURLOPT_POSTFIELDSIZE option. (Added in 7.11.1)
1175
1176 CURLOPT_COPYPOSTFIELDS
1177 Pass a char * as parameter, which should be the full data to
1178 post in an HTTP POST operation. It behaves as the CURLOPT_POST‐
1179 FIELDS option, but the original data are copied by the library,
1180 allowing the application to overwrite the original data after
1181 setting this option.
1182
1183 Because data are copied, care must be taken when using this
1184 option in conjunction with CURLOPT_POSTFIELDSIZE or CUR‐
1185 LOPT_POSTFIELDSIZE_LARGE: If the size has not been set prior to
1186 CURLOPT_COPYPOSTFIELDS, the data are assumed to be a NUL-termi‐
1187 nated string; else the stored size informs the library about the
1188 data byte count to copy. In any case, the size must not be
1189 changed after CURLOPT_COPYPOSTFIELDS, unless another CUR‐
1190 LOPT_POSTFIELDS or CURLOPT_COPYPOSTFIELDS option is issued.
1191 (Added in 7.17.1)
1192
1193 CURLOPT_HTTPPOST
1194 Tells libcurl you want a multipart/formdata HTTP POST to be made
1195 and you instruct what data to pass on to the server. Pass a
1196 pointer to a linked list of curl_httppost structs as parameter.
1197 The easiest way to create such a list, is to use curl_formadd(3)
1198 as documented. The data in this list must remain intact until
1199 you close this curl handle again with curl_easy_cleanup(3).
1200
1201 Using POST with HTTP 1.1 implies the use of a "Expect: 100-con‐
1202 tinue" header. You can disable this header with CURLOPT_HTTP‐
1203 HEADER as usual.
1204
1205 When setting CURLOPT_HTTPPOST, it will automatically set CUR‐
1206 LOPT_NOBODY to 0 (since 7.14.1).
1207
1208 CURLOPT_REFERER
1209 Pass a pointer to a zero terminated string as parameter. It will
1210 be used to set the Referer: header in the http request sent to
1211 the remote server. This can be used to fool servers or scripts.
1212 You can also set any custom header with CURLOPT_HTTPHEADER.
1213
1214 CURLOPT_USERAGENT
1215 Pass a pointer to a zero terminated string as parameter. It will
1216 be used to set the User-Agent: header in the http request sent
1217 to the remote server. This can be used to fool servers or
1218 scripts. You can also set any custom header with CURLOPT_HTTP‐
1219 HEADER.
1220
1221 CURLOPT_HTTPHEADER
1222 Pass a pointer to a linked list of HTTP headers to pass to the
1223 server in your HTTP request. The linked list should be a fully
1224 valid list of struct curl_slist structs properly filled in. Use
1225 curl_slist_append(3) to create the list and
1226 curl_slist_free_all(3) to clean up an entire list. If you add a
1227 header that is otherwise generated and used by libcurl inter‐
1228 nally, your added one will be used instead. If you add a header
1229 with no content as in 'Accept:' (no data on the right side of
1230 the colon), the internally used header will get disabled. Thus,
1231 using this option you can add new headers, replace internal
1232 headers and remove internal headers. To add a header with no
1233 content, make the content be two quotes: "". The headers
1234 included in the linked list must not be CRLF-terminated, because
1235 curl adds CRLF after each header item. Failure to comply with
1236 this will result in strange bugs because the server will most
1237 likely ignore part of the headers you specified.
1238
1239 The first line in a request (containing the method, usually a
1240 GET or POST) is not a header and cannot be replaced using this
1241 option. Only the lines following the request-line are headers.
1242 Adding this method line in this list of headers will only cause
1243 your request to send an invalid header.
1244
1245 Pass a NULL to this to reset back to no custom headers.
1246
1247 The most commonly replaced headers have "shortcuts" in the
1248 options CURLOPT_COOKIE, CURLOPT_USERAGENT and CURLOPT_REFERER.
1249
1250 CURLOPT_HTTP200ALIASES
1251 Pass a pointer to a linked list of aliases to be treated as
1252 valid HTTP 200 responses. Some servers respond with a custom
1253 header response line. For example, IceCast servers respond with
1254 "ICY 200 OK". By including this string in your list of aliases,
1255 the response will be treated as a valid HTTP header line such as
1256 "HTTP/1.0 200 OK". (Added in 7.10.3)
1257
1258 The linked list should be a fully valid list of struct
1259 curl_slist structs, and be properly filled in. Use
1260 curl_slist_append(3) to create the list and
1261 curl_slist_free_all(3) to clean up an entire list.
1262
1263 The alias itself is not parsed for any version strings. Before
1264 libcurl 7.16.3, Libcurl used the value set by option CUR‐
1265 LOPT_HTTP_VERSION, but starting with 7.16.3 the protocol is
1266 assumed to match HTTP 1.0 when an alias matched.
1267
1268 CURLOPT_COOKIE
1269 Pass a pointer to a zero terminated string as parameter. It will
1270 be used to set a cookie in the http request. The format of the
1271 string should be NAME=CONTENTS, where NAME is the cookie name
1272 and CONTENTS is what the cookie should contain.
1273
1274 If you need to set multiple cookies, you need to set them all
1275 using a single option and thus you need to concatenate them all
1276 in one single string. Set multiple cookies in one string like
1277 this: "name1=content1; name2=content2;" etc.
1278
1279 This option sets the cookie header explictly in the outgoing
1280 request(s). If multiple requests are done due to authentication,
1281 followed redirections or similar, they will all get this cookie
1282 passed on.
1283
1284 Using this option multiple times will only make the latest
1285 string override the previous ones.
1286
1287 CURLOPT_COOKIEFILE
1288 Pass a pointer to a zero terminated string as parameter. It
1289 should contain the name of your file holding cookie data to
1290 read. The cookie data may be in Netscape / Mozilla cookie data
1291 format or just regular HTTP-style headers dumped to a file.
1292
1293 Given an empty or non-existing file or by passing the empty
1294 string (""), this option will enable cookies for this curl han‐
1295 dle, making it understand and parse received cookies and then
1296 use matching cookies in future requests.
1297
1298 If you use this option multiple times, you just add more files
1299 to read. Subsequent files will add more cookies.
1300
1301 CURLOPT_COOKIEJAR
1302 Pass a file name as char *, zero terminated. This will make
1303 libcurl write all internally known cookies to the specified file
1304 when curl_easy_cleanup(3) is called. If no cookies are known, no
1305 file will be created. Specify "-" to instead have the cookies
1306 written to stdout. Using this option also enables cookies for
1307 this session, so if you for example follow a location it will
1308 make matching cookies get sent accordingly.
1309
1310 If the cookie jar file can't be created or written to (when the
1311 curl_easy_cleanup(3) is called), libcurl will not and cannot
1312 report an error for this. Using CURLOPT_VERBOSE or CUR‐
1313 LOPT_DEBUGFUNCTION will get a warning to display, but that is
1314 the only visible feedback you get about this possibly lethal
1315 situation.
1316
1317 CURLOPT_COOKIESESSION
1318 Pass a long set to 1 to mark this as a new cookie "session". It
1319 will force libcurl to ignore all cookies it is about to load
1320 that are "session cookies" from the previous session. By
1321 default, libcurl always stores and loads all cookies, indepen‐
1322 dent if they are session cookies or not. Session cookies are
1323 cookies without expiry date and they are meant to be alive and
1324 existing for this "session" only.
1325
1326 CURLOPT_COOKIELIST
1327 Pass a char * to a cookie string. Cookie can be either in Net‐
1328 scape / Mozilla format or just regular HTTP-style header (Set-
1329 Cookie: ...) format. If cURL cookie engine was not enabled it
1330 will enable its cookie engine. Passing a magic string "ALL"
1331 will erase all cookies known by cURL. (Added in 7.14.1) Passing
1332 the special string "SESS" will only erase all session cookies
1333 known by cURL. (Added in 7.15.4) Passing the special string
1334 "FLUSH" will write all cookies known by cURL to the file speci‐
1335 fied by CURLOPT_COOKIEJAR. (Added in 7.17.1)
1336
1337 CURLOPT_HTTPGET
1338 Pass a long. If the long is 1, this forces the HTTP request to
1339 get back to GET. Usable if a POST, HEAD, PUT, or a custom
1340 request has been used previously using the same curl handle.
1341
1342 When setting CURLOPT_HTTPGET to 1, it will automatically set
1343 CURLOPT_NOBODY to 0 (since 7.14.1).
1344
1345 CURLOPT_HTTP_VERSION
1346 Pass a long, set to one of the values described below. They
1347 force libcurl to use the specific HTTP versions. This is not
1348 sensible to do unless you have a good reason.
1349
1350 CURL_HTTP_VERSION_NONE
1351 We don't care about what version the library uses.
1352 libcurl will use whatever it thinks fit.
1353
1354 CURL_HTTP_VERSION_1_0
1355 Enforce HTTP 1.0 requests.
1356
1357 CURL_HTTP_VERSION_1_1
1358 Enforce HTTP 1.1 requests.
1359
1360 CURLOPT_IGNORE_CONTENT_LENGTH
1361 Ignore the Content-Length header. This is useful for Apache 1.x
1362 (and similar servers) which will report incorrect content length
1363 for files over 2 gigabytes. If this option is used, curl will
1364 not be able to accurately report progress, and will simply stop
1365 the download when the server ends the connection. (added in
1366 7.14.1)
1367
1368 CURLOPT_HTTP_CONTENT_DECODING
1369 Pass a long to tell libcurl how to act on content decoding. If
1370 set to zero, content decoding will be disabled. If set to 1 it
1371 is enabled. Libcurl has no default content decoding but requires
1372 you to use CURLOPT_ENCODING for that. (added in 7.16.2)
1373
1374 CURLOPT_HTTP_TRANSFER_DECODING
1375 Pass a long to tell libcurl how to act on transfer decoding. If
1376 set to zero, transfer decoding will be disabled, if set to 1 it
1377 is enabled (default). libcurl does chunked transfer decoding by
1378 default unless this option is set to zero. (added in 7.16.2)
1379
1381 CURLOPT_MAIL_FROM
1382 Pass a pointer to a zero terminated string as parameter. It will
1383 be used to specify the sender address in a mail when sending an
1384 SMTP mail with libcurl.
1385
1386 (Added in 7.20.0)
1387
1388 CURLOPT_MAIL_RCPT
1389 Pass a pointer to a linked list of recipients to pass to the
1390 server in your SMTP mail request. The linked list should be a
1391 fully valid list of struct curl_slist structs properly filled
1392 in. Use curl_slist_append(3) to create the list and
1393 curl_slist_free_all(3) to clean up an entire list.
1394
1395 Each recipient in SMTP lingo is specified with angle brackets
1396 (<>), but should you not use an angle bracket as first letter
1397 libcurl will assume you provide a single email address only and
1398 enclose that with angle brackets for you.
1399
1400 (Added in 7.20.0)
1401
1403 CURLOPT_TFTP_BLKSIZE
1404 Specify block size to use for TFTP data transmission. Valid
1405 range as per RFC 2348 is 8-65464 bytes. The default of 512 bytes
1406 will be used if this option is not specified. The specified
1407 block size will only be used pending support by the remote
1408 server. If the server does not return an option acknowledgement
1409 or returns an option acknowledgement with no blksize, the
1410 default of 512 bytes will be used. (added in 7.19.4)
1411
1413 CURLOPT_FTPPORT
1414 Pass a pointer to a zero terminated string as parameter. It will
1415 be used to get the IP address to use for the FTP PORT instruc‐
1416 tion. The PORT instruction tells the remote server to connect to
1417 our specified IP address. The string may be a plain IP address,
1418 a host name, a network interface name (under Unix) or just a '-'
1419 symbol to let the library use your system's default IP address.
1420 Default FTP operations are passive, and thus won't use PORT.
1421
1422 The address can be followed by a ':' to specify a port, option‐
1423 ally followed by a '-' to specify a port range. If the port
1424 specified is 0, the operating system will pick a free port. If
1425 a range is provided and all ports in the range are not avail‐
1426 able, libcurl will report CURLE_FTP_PORT_FAILED for the handle.
1427 Invalid port/range settings are ignored. IPv6 addresses fol‐
1428 lowed by a port or portrange have to be in brackets. IPv6
1429 addresses without port/range specifier can be in brackets.
1430 (added in 7.19.5)
1431
1432 Examples with specified ports:
1433
1434 eth0:0
1435 192.168.1.2:32000-33000
1436 curl.se:32123
1437 [::1]:1234-4567
1438
1439 You disable PORT again and go back to using the passive version
1440 by setting this option to NULL.
1441
1442 CURLOPT_QUOTE
1443 Pass a pointer to a linked list of FTP or SFTP commands to pass
1444 to the server prior to your FTP request. This will be done
1445 before any other commands are issued (even before the CWD com‐
1446 mand for FTP). The linked list should be a fully valid list of
1447 'struct curl_slist' structs properly filled in with text
1448 strings. Use curl_slist_append(3) to append strings (commands)
1449 to the list, and clear the entire list afterwards with
1450 curl_slist_free_all(3). Disable this operation again by setting
1451 a NULL to this option. The set of valid FTP commands depends on
1452 the server (see RFC959 for a list of mandatory commands). The
1453 valid SFTP commands are: chgrp, chmod, chown, ln, mkdir, pwd,
1454 rename, rm, rmdir, symlink (see curl(1)) (SFTP support added in
1455 7.16.3)
1456
1457 CURLOPT_POSTQUOTE
1458 Pass a pointer to a linked list of FTP or SFTP commands to pass
1459 to the server after your FTP transfer request. The commands will
1460 only be run if no error occurred. The linked list should be a
1461 fully valid list of struct curl_slist structs properly filled in
1462 as described for CURLOPT_QUOTE. Disable this operation again by
1463 setting a NULL to this option.
1464
1465 CURLOPT_PREQUOTE
1466 Pass a pointer to a linked list of FTP commands to pass to the
1467 server after the transfer type is set. The linked list should be
1468 a fully valid list of struct curl_slist structs properly filled
1469 in as described for CURLOPT_QUOTE. Disable this operation again
1470 by setting a NULL to this option. Before version 7.15.6, if you
1471 also set CURLOPT_NOBODY to 1, this option didn't work.
1472
1473 CURLOPT_DIRLISTONLY
1474 A parameter set to 1 tells the library to just list the names of
1475 files in a directory, instead of doing a full directory listing
1476 that would include file sizes, dates etc. This works for FTP and
1477 SFTP URLs.
1478
1479 This causes an FTP NLST command to be sent on an FTP server.
1480 Beware that some FTP servers list only files in their response
1481 to NLST; they might not include subdirectories and symbolic
1482 links.
1483
1484 (This option was known as CURLOPT_FTPLISTONLY up to 7.16.4)
1485
1486 CURLOPT_APPEND
1487 A parameter set to 1 tells the library to append to the remote
1488 file instead of overwrite it. This is only useful when uploading
1489 to an FTP site.
1490
1491 (This option was known as CURLOPT_FTPAPPEND up to 7.16.4)
1492
1493 CURLOPT_FTP_USE_EPRT
1494 Pass a long. If the value is 1, it tells curl to use the EPRT
1495 (and LPRT) command when doing active FTP downloads (which is
1496 enabled by CURLOPT_FTPPORT). Using EPRT means that it will first
1497 attempt to use EPRT and then LPRT before using PORT, but if you
1498 pass zero to this option, it will not try using EPRT or LPRT,
1499 only plain PORT. (Added in 7.10.5)
1500
1501 If the server is an IPv6 host, this option will have no effect
1502 as of 7.12.3.
1503
1504 CURLOPT_FTP_USE_EPSV
1505 Pass a long. If the value is 1, it tells curl to use the EPSV
1506 command when doing passive FTP downloads (which it always does
1507 by default). Using EPSV means that it will first attempt to use
1508 EPSV before using PASV, but if you pass zero to this option, it
1509 will not try using EPSV, only plain PASV.
1510
1511 If the server is an IPv6 host, this option will have no effect
1512 as of 7.12.3.
1513
1514 CURLOPT_FTP_USE_PRET
1515 Pass a long. If the value is 1, it tells curl to send a PRET
1516 command before PASV (and EPSV). Certain FTP servers, mainly
1517 drftpd, require this non-standard command for directory listings
1518 as well as up and downloads in PASV mode. Has no effect when
1519 using the active FTP transfers mode. (Added in 7.20.0)
1520
1521 CURLOPT_FTP_CREATE_MISSING_DIRS
1522 Pass a long. If the value is 1, curl will attempt to create any
1523 remote directory that it fails to CWD into. CWD is the command
1524 that changes working directory. (Added in 7.10.7)
1525
1526 This setting also applies to SFTP-connections. curl will attempt
1527 to create the remote directory if it can't obtain a handle to
1528 the target-location. The creation will fail if a file of the
1529 same name as the directory to create already exists or lack of
1530 permissions prevents creation. (Added in 7.16.3)
1531
1532 Starting with 7.19.4, you can also set this value to 2, which
1533 will make libcurl retry the CWD command again if the subsequent
1534 MKD command fails. This is especially useful if you're doing
1535 many simultanoes connections against the same server and they
1536 all have this option enabled, as then CWD may first fail but
1537 then another connection does MKD before this connection and thus
1538 MKD fails but trying CWD works! 7.19.4 also introduced the
1539 CURLFTP_CREATE_DIR and CURLFTP_CREATE_DIR_RETRY enum names for
1540 these arguments.
1541
1542 Before version 7.19.4, libcurl will simply ignore arguments set
1543 to 2 and act as if 1 was selected.
1544
1545 CURLOPT_FTP_RESPONSE_TIMEOUT
1546 Pass a long. Causes curl to set a timeout period (in seconds)
1547 on the amount of time that the server is allowed to take in
1548 order to generate a response message for a command before the
1549 session is considered hung. While curl is waiting for a
1550 response, this value overrides CURLOPT_TIMEOUT. It is recom‐
1551 mended that if used in conjunction with CURLOPT_TIMEOUT, you set
1552 CURLOPT_FTP_RESPONSE_TIMEOUT to a value smaller than CUR‐
1553 LOPT_TIMEOUT. (Added in 7.10.8)
1554
1555 CURLOPT_FTP_ALTERNATIVE_TO_USER
1556 Pass a char * as parameter, pointing to a string which will be
1557 used to authenticate if the usual FTP "USER user" and "PASS
1558 password" negotiation fails. This is currently only known to be
1559 required when connecting to Tumbleweed's Secure Transport FTPS
1560 server using client certificates for authentication. (Added in
1561 7.15.5)
1562
1563 CURLOPT_FTP_SKIP_PASV_IP
1564 Pass a long. If set to 1, it instructs libcurl to not use the IP
1565 address the server suggests in its 227-response to libcurl's
1566 PASV command when libcurl connects the data connection. Instead
1567 libcurl will re-use the same IP address it already uses for the
1568 control connection. But it will use the port number from the
1569 227-response. (Added in 7.14.2)
1570
1571 This option has no effect if PORT, EPRT or EPSV is used instead
1572 of PASV.
1573
1574 CURLOPT_USE_SSL
1575 Pass a long using one of the values from below, to make libcurl
1576 use your desired level of SSL for the FTP transfer. (Added in
1577 7.11.0)
1578
1579 (This option was known as CURLOPT_FTP_SSL up to 7.16.4, and the
1580 constants were known as CURLFTPSSL_*)
1581
1582 CURLUSESSL_NONE
1583 Don't attempt to use SSL.
1584
1585 CURLUSESSL_TRY
1586 Try using SSL, proceed as normal otherwise.
1587
1588 CURLUSESSL_CONTROL
1589 Require SSL for the control connection or fail with
1590 CURLE_USE_SSL_FAILED.
1591
1592 CURLUSESSL_ALL
1593 Require SSL for all communication or fail with
1594 CURLE_USE_SSL_FAILED.
1595
1596 CURLOPT_FTPSSLAUTH
1597 Pass a long using one of the values from below, to alter how
1598 libcurl issues "AUTH TLS" or "AUTH SSL" when FTP over SSL is
1599 activated (see CURLOPT_USE_SSL). (Added in 7.12.2)
1600
1601 CURLFTPAUTH_DEFAULT
1602 Allow libcurl to decide.
1603
1604 CURLFTPAUTH_SSL
1605 Try "AUTH SSL" first, and only if that fails try "AUTH
1606 TLS".
1607
1608 CURLFTPAUTH_TLS
1609 Try "AUTH TLS" first, and only if that fails try "AUTH
1610 SSL".
1611
1612 CURLOPT_FTP_SSL_CCC
1613 If enabled, this option makes libcurl use CCC (Clear Command
1614 Channel). It shuts down the SSL/TLS layer after authenticating.
1615 The rest of the control channel communication will be unen‐
1616 crypted. This allows NAT routers to follow the FTP transaction.
1617 Pass a long using one of the values below. (Added in 7.16.1)
1618
1619 CURLFTPSSL_CCC_NONE
1620 Don't attempt to use CCC.
1621
1622 CURLFTPSSL_CCC_PASSIVE
1623 Do not initiate the shutdown, but wait for the server to
1624 do it. Do not send a reply.
1625
1626 CURLFTPSSL_CCC_ACTIVE
1627 Initiate the shutdown and wait for a reply.
1628
1629 CURLOPT_FTP_ACCOUNT
1630 Pass a pointer to a zero-terminated string (or NULL to disable).
1631 When an FTP server asks for "account data" after user name and
1632 password has been provided, this data is sent off using the ACCT
1633 command. (Added in 7.13.0)
1634
1635 CURLOPT_FTP_FILEMETHOD
1636 Pass a long that should have one of the following values. This
1637 option controls what method libcurl should use to reach a file
1638 on a FTP(S) server. The argument should be one of the following
1639 alternatives:
1640
1641 CURLFTPMETHOD_MULTICWD
1642 libcurl does a single CWD operation for each path part in
1643 the given URL. For deep hierarchies this means many com‐
1644 mands. This is how RFC1738 says it should be done. This
1645 is the default but the slowest behavior.
1646
1647 CURLFTPMETHOD_NOCWD
1648 libcurl does no CWD at all. libcurl will do SIZE, RETR,
1649 STOR etc and give a full path to the server for all these
1650 commands. This is the fastest behavior.
1651
1652 CURLFTPMETHOD_SINGLECWD
1653 libcurl does one CWD with the full target directory and
1654 then operates on the file "normally" (like in the multi‐
1655 cwd case). This is somewhat more standards compliant than
1656 'nocwd' but without the full penalty of 'multicwd'.
1657 (Added in 7.15.1)
1658
1660 CURLOPT_RTSP_REQUEST
1661 Tell libcurl what kind of RTSP request to make. Pass one of the
1662 following RTSP enum values. Unless noted otherwise, commands
1663 require the Session ID to be initialized. (Added in 7.20.0)
1664
1665 CURL_RTSPREQ_OPTIONS
1666 Used to retrieve the available methods of the server. The
1667 application is responsbile for parsing and obeying the
1668 response. (The session ID is not needed for this method.)
1669 (Added in 7.20.0)
1670
1671 CURL_RTSPREQ_DESCRIBE
1672 Used to get the low level description of a stream. The
1673 application should note what formats it understands in
1674 the 'Accept:' header. Unless set manually, libcurl will
1675 automatically fill in 'Accept: application/sdp'. Time-
1676 condition headers will be added to Describe requests if
1677 the CURLOPT_TIMECONDITION option is active. (The session
1678 ID is not needed for this method) (Added in 7.20.0)
1679
1680 CURL_RTSPREQ_ANNOUNCE
1681 When sent by a client, this method changes the descrip‐
1682 tion of the session. For example, if a client is using
1683 the server to record a meeting, the client can use
1684 Announce to inform the server of all the meta-information
1685 about the session. ANNOUNCE acts like an HTTP PUT or
1686 POST just like CURL_RTSPREQ_SET_PARAMETER (Added in
1687 7.20.0)
1688
1689 CURL_RTSPREQ_SETUP
1690 Setup is used to initialize the transport layer for the
1691 session. The application must set the desired Transport
1692 options for a session by using the CURLOPT_RTSP_TRANSPORT
1693 option prior to calling setup. If no session ID is cur‐
1694 rently set with CURLOPT_RTSP_SESSION_ID, libcurl will
1695 extract and use the session ID in the response to this
1696 request. (The session ID is not needed for this method).
1697 (Added in 7.20.0)
1698
1699 CURL_RTSPREQ_PLAY
1700 Send a Play command to the server. Use the CURLOPT_RANGE
1701 option to modify the playback time (e.g. 'npt=10-15').
1702 (Added in 7.20.0)
1703
1704 CURL_RTSPREQ_PAUSE
1705 Send a Pause command to the server. Use the CURLOPT_RANGE
1706 option with a single value to indicate when the stream
1707 should be halted. (e.g. npt='25') (Added in 7.20.0)
1708
1709 CURL_RTSPREQ_TEARDOWN
1710 This command terminates an RTSP session. Simply closing a
1711 connection does not terminate the RTSP session since it
1712 is valid to control an RTSP session over different con‐
1713 nections. (Added in 7.20.0)
1714
1715 CURL_RTSPREQ_GET_PARAMETER
1716 Retrieve a parameter from the server. By default, libcurl
1717 will automatically include a Content-Type: text/parame‐
1718 ters header on all non-empty requests unless a custom one
1719 is set. GET_PARAMETER acts just like an HTTP PUT or POST
1720 (see CURL_RTSPREQ_SET_PARAMETER). Applications wishing
1721 to send a heartbeat message (e.g. in the presence of a
1722 server-specified timeout) should send use an empty
1723 GET_PARAMETER request. (Added in 7.20.0)
1724
1725 CURL_RTSPREQ_SET_PARAMETER
1726 Set a parameter on the server. By default, libcurl will
1727 automatically include a Content-Type: text/parameters
1728 header unless a custom one is set. The interaction with
1729 SET_PARAMTER is much like an HTTP PUT or POST. An appli‐
1730 cation may either use CURLOPT_UPLOAD with CURLOPT_READ‐
1731 DATA like an HTTP PUT, or it may use CURLOPT_POSTFIELDS
1732 like an HTTP POST. No chunked transfers are allowed, so
1733 the application must set the CURLOPT_INFILESIZE in the
1734 former and CURLOPT_POSTFIELDSIZE in the latter. Also,
1735 there is no use of multi-part POSTs within RTSP. (Added
1736 in 7.20.0)
1737
1738 CURL_RTSPREQ_RECORD
1739 Used to tell the server to record a session. Use the CUR‐
1740 LOPT_RANGE option to modify the record time. (Added in
1741 7.20.0)
1742
1743 CURL_RTSPREQ_RECEIVE
1744 This is a special request because it does not send any
1745 data to the server. The application may call this func‐
1746 tion in order to receive interleaved RTP data. It will
1747 return after processing one read buffer of data in order
1748 to give the application a chance to run. (Added in
1749 7.20.0)
1750
1751 CURLOPT_RTSP_SESSION_ID
1752 Pass a char * as a parameter to set the value of the current
1753 RTSP Session ID for the handle. Useful for resuming an in-
1754 progress session. Once this value is set to any non-NULL value,
1755 libcurl will return CURLE_RTSP_SESSION_ERROR if ID received from
1756 the server does not match. If unset (or set to NULL), libcurl
1757 will automatically set the ID the first time the server sets it
1758 in a response. (Added in 7.20.0)
1759
1760 CURLOPT_RTSP_STREAM_URI
1761 Set the stream URI to operate on by passing a char * . For exam‐
1762 ple, a single session may be controlling
1763 rtsp://foo/twister/audio and rtsp://foo/twister/video and the
1764 application can switch to the appropriate stream using this
1765 option. If unset, libcurl will default to operating on generic
1766 server options by passing '*' in the place of the RTSP Stream
1767 URI. This option is distinct from CURLOPT_URL. When working with
1768 RTSP, the CURLOPT_STREAM_URI indicates what URL to send to the
1769 server in the request header while the CURLOPT_URL indicates
1770 where to make the connection to. (e.g. the CURLOPT_URL for the
1771 above examples might be set to rtsp://foo/twister (Added in
1772 7.20.0)
1773
1774 CURLOPT_RTSP_TRANSPORT
1775 Pass a char * to tell libcurl what to pass for the Transport:
1776 header for this RTSP session. This is mainly a convenience
1777 method to avoid needing to set a custom Transport: header for
1778 every SETUP request. The application must set a Transport:
1779 header before issuing a SETUP request. (Added in 7.20.0)
1780
1781 CURLOPT_RTSP_HEADER
1782 This option is simply an alias for CURLOPT_HTTP_HEADER. Use this
1783 to replace the standard headers that RTSP and HTTP share. It is
1784 also valid to use the shortcuts such as CURLOPT_USERAGENT.
1785 (Added in 7.20.0)
1786
1787 CURLOPT_RTSP_CLIENT_CSEQ
1788 Manually set the the CSEQ number to issue for the next RTSP
1789 request. Useful if the application is resuming a previously bro‐
1790 ken connection. The CSEQ will increment from this new number
1791 henceforth. (Added in 7.20.0)
1792
1793 CURLOPT_RTSP_SERVER_CSEQ
1794 Manually set the CSEQ number to expect for the next RTSP
1795 Server->Client request. At the moment, this feature (listening
1796 for Server requests) is unimplemented. (Added in 7.20.0)
1797
1799 CURLOPT_TRANSFERTEXT
1800 A parameter set to 1 tells the library to use ASCII mode for FTP
1801 transfers, instead of the default binary transfer. For win32
1802 systems it does not set the stdout to binary mode. This option
1803 can be usable when transferring text data between systems with
1804 different views on certain characters, such as newlines or simi‐
1805 lar.
1806
1807 libcurl does not do a complete ASCII conversion when doing ASCII
1808 transfers over FTP. This is a known limitation/flaw that nobody
1809 has rectified. libcurl simply sets the mode to ASCII and per‐
1810 forms a standard transfer.
1811
1812 CURLOPT_PROXY_TRANSFER_MODE
1813 Pass a long. If the value is set to 1 (one), it tells libcurl to
1814 set the transfer mode (binary or ASCII) for FTP transfers done
1815 via an HTTP proxy, by appending ;type=a or ;type=i to the URL.
1816 Without this setting, or it being set to 0 (zero, the default),
1817 CURLOPT_TRANSFERTEXT has no effect when doing FTP via a proxy.
1818 Beware that not all proxies support this feature. (Added in
1819 7.18.0)
1820
1821 CURLOPT_CRLF
1822 Convert Unix newlines to CRLF newlines on transfers.
1823
1824 CURLOPT_RANGE
1825 Pass a char * as parameter, which should contain the specified
1826 range you want. It should be in the format "X-Y", where X or Y
1827 may be left out. HTTP transfers also support several intervals,
1828 separated with commas as in "X-Y,N-M". Using this kind of multi‐
1829 ple intervals will cause the HTTP server to send the response
1830 document in pieces (using standard MIME separation techniques).
1831 For RTSP, the formatting of a range should follow RFC 2326 Sec‐
1832 tion 12.29. For RTSP, byte ranges are not permitted. Instead,
1833 ranges should be given in npt, utc, or smpte formats.
1834
1835 Pass a NULL to this option to disable the use of ranges.
1836
1837 Ranges work on HTTP, FTP, FILE (since 7.18.0), and RTSP (since
1838 7.20.0) transfers only.
1839
1840 CURLOPT_RESUME_FROM
1841 Pass a long as parameter. It contains the offset in number of
1842 bytes that you want the transfer to start from. Set this option
1843 to 0 to make the transfer start from the beginning (effectively
1844 disabling resume). For FTP, set this option to -1 to make the
1845 transfer start from the end of the target file (useful to con‐
1846 tinue an interrupted upload).
1847
1848 CURLOPT_RESUME_FROM_LARGE
1849 Pass a curl_off_t as parameter. It contains the offset in number
1850 of bytes that you want the transfer to start from. (Added in
1851 7.11.0)
1852
1853 CURLOPT_CUSTOMREQUEST
1854 Pass a pointer to a zero terminated string as parameter. It will
1855 be used instead of GET or HEAD when doing an HTTP request, or
1856 instead of LIST or NLST when doing a FTP directory listing. This
1857 is useful for doing DELETE or other more or less obscure HTTP
1858 requests. Don't do this at will, make sure your server supports
1859 the command first.
1860
1861 When you change the request method by setting CURLOPT_CUSTOMRE‐
1862 QUEST to something, you don't actually change how libcurl
1863 behaves or acts in regards to the particular request method, it
1864 will only change the actual string sent in the request.
1865
1866 For example: if you tell libcurl to do a HEAD request, but then
1867 change the request to a "GET" with CURLOPT_CUSTOMREQUEST you'll
1868 still see libcurl act as if it sent a HEAD even when it does
1869 send a GET.
1870
1871 To switch to a proper HEAD, use CURLOPT_NOBODY, to switch to a
1872 proper POST, use CURLOPT_POST or CURLOPT_POSTFIELDS and so on.
1873
1874 Restore to the internal default by setting this to NULL.
1875
1876 Many people have wrongly used this option to replace the entire
1877 request with their own, including multiple headers and POST con‐
1878 tents. While that might work in many cases, it will cause
1879 libcurl to send invalid requests and it could possibly confuse
1880 the remote server badly. Use CURLOPT_POST and CURLOPT_POSTFIELDS
1881 to set POST data. Use CURLOPT_HTTPHEADER to replace or extend
1882 the set of headers sent by libcurl. Use CURLOPT_HTTP_VERSION to
1883 change HTTP version.
1884
1885 CURLOPT_FILETIME
1886 Pass a long. If it is 1, libcurl will attempt to get the modifi‐
1887 cation date of the remote document in this operation. This
1888 requires that the remote server sends the time or replies to a
1889 time querying command. The curl_easy_getinfo(3) function with
1890 the CURLINFO_FILETIME argument can be used after a transfer to
1891 extract the received time (if any).
1892
1893 CURLOPT_NOBODY
1894 A parameter set to 1 tells the library to not include the body-
1895 part in the output. This is only relevant for protocols that
1896 have separate header and body parts. On HTTP(S) servers, this
1897 will make libcurl do a HEAD request.
1898
1899 To change request to GET, you should use CURLOPT_HTTPGET. Change
1900 request to POST with CURLOPT_POST etc.
1901
1902 CURLOPT_INFILESIZE
1903 When uploading a file to a remote site, this option should be
1904 used to tell libcurl what the expected size of the infile is.
1905 This value should be passed as a long. See also CURLOPT_INFILE‐
1906 SIZE_LARGE.
1907
1908 For uploading using SCP, this option or CURLOPT_INFILESIZE_LARGE
1909 is mandatory.
1910
1911 This option does not limit how much data libcurl will actually
1912 send, as that is controlled entirely by what the read callback
1913 returns.
1914
1915 CURLOPT_INFILESIZE_LARGE
1916 When uploading a file to a remote site, this option should be
1917 used to tell libcurl what the expected size of the infile is.
1918 This value should be passed as a curl_off_t. (Added in 7.11.0)
1919
1920 For uploading using SCP, this option or CURLOPT_INFILESIZE is
1921 mandatory.
1922
1923 This option does not limit how much data libcurl will actually
1924 send, as that is controlled entirely by what the read callback
1925 returns.
1926
1927 CURLOPT_UPLOAD
1928 A parameter set to 1 tells the library to prepare for an upload.
1929 The CURLOPT_READDATA and CURLOPT_INFILESIZE or CURLOPT_INFILE‐
1930 SIZE_LARGE options are also interesting for uploads. If the pro‐
1931 tocol is HTTP, uploading means using the PUT request unless you
1932 tell libcurl otherwise.
1933
1934 Using PUT with HTTP 1.1 implies the use of a "Expect: 100-con‐
1935 tinue" header. You can disable this header with CURLOPT_HTTP‐
1936 HEADER as usual.
1937
1938 If you use PUT to a HTTP 1.1 server, you can upload data without
1939 knowing the size before starting the transfer if you use chunked
1940 encoding. You enable this by adding a header like "Transfer-
1941 Encoding: chunked" with CURLOPT_HTTPHEADER. With HTTP 1.0 or
1942 without chunked transfer, you must specify the size.
1943
1944 CURLOPT_MAXFILESIZE
1945 Pass a long as parameter. This allows you to specify the maximum
1946 size (in bytes) of a file to download. If the file requested is
1947 larger than this value, the transfer will not start and
1948 CURLE_FILESIZE_EXCEEDED will be returned.
1949
1950 The file size is not always known prior to download, and for
1951 such files this option has no effect even if the file transfer
1952 ends up being larger than this given limit. This concerns both
1953 FTP and HTTP transfers.
1954
1955 CURLOPT_MAXFILESIZE_LARGE
1956 Pass a curl_off_t as parameter. This allows you to specify the
1957 maximum size (in bytes) of a file to download. If the file
1958 requested is larger than this value, the transfer will not start
1959 and CURLE_FILESIZE_EXCEEDED will be returned. (Added in 7.11.0)
1960
1961 The file size is not always known prior to download, and for
1962 such files this option has no effect even if the file transfer
1963 ends up being larger than this given limit. This concerns both
1964 FTP and HTTP transfers.
1965
1966 CURLOPT_TIMECONDITION
1967 Pass a long as parameter. This defines how the CURLOPT_TIMEVALUE
1968 time value is treated. You can set this parameter to CURL_TIME‐
1969 COND_IFMODSINCE or CURL_TIMECOND_IFUNMODSINCE. This feature
1970 applies to HTTP, FTP, and RTSP.
1971
1972 The last modification time of a file is not always known and in
1973 such instances this feature will have no effect even if the
1974 given time condition would not have been met. curl_easy_get‐
1975 info(3) with the CURLINFO_CONDITION_UNMET option can be used
1976 after a transfer to learn if a zero-byte successful "transfer"
1977 was due to this condition not matching.
1978
1979 CURLOPT_TIMEVALUE
1980 Pass a long as parameter. This should be the time in seconds
1981 since 1 Jan 1970, and the time will be used in a condition as
1982 specified with CURLOPT_TIMECONDITION.
1983
1985 CURLOPT_TIMEOUT
1986 Pass a long as parameter containing the maximum time in seconds
1987 that you allow the libcurl transfer operation to take. Normally,
1988 name lookups can take a considerable time and limiting opera‐
1989 tions to less than a few minutes risk aborting perfectly normal
1990 operations. This option will cause curl to use the SIGALRM to
1991 enable time-outing system calls.
1992
1993 In unix-like systems, this might cause signals to be used unless
1994 CURLOPT_NOSIGNAL is set.
1995
1996 CURLOPT_TIMEOUT_MS
1997 Like CURLOPT_TIMEOUT but takes number of milliseconds instead.
1998 If libcurl is built to use the standard system name resolver,
1999 that portion of the transfer will still use full-second resolu‐
2000 tion for timeouts with a minimum timeout allowed of one second.
2001 (Added in 7.16.2)
2002
2003 CURLOPT_LOW_SPEED_LIMIT
2004 Pass a long as parameter. It contains the transfer speed in
2005 bytes per second that the transfer should be below during CUR‐
2006 LOPT_LOW_SPEED_TIME seconds for the library to consider it too
2007 slow and abort.
2008
2009 CURLOPT_LOW_SPEED_TIME
2010 Pass a long as parameter. It contains the time in seconds that
2011 the transfer should be below the CURLOPT_LOW_SPEED_LIMIT for the
2012 library to consider it too slow and abort.
2013
2014 CURLOPT_MAX_SEND_SPEED_LARGE
2015 Pass a curl_off_t as parameter. If an upload exceeds this speed
2016 (counted in bytes per second) on cumulative average during the
2017 transfer, the transfer will pause to keep the average rate less
2018 than or equal to the parameter value. Defaults to unlimited
2019 speed. (Added in 7.15.5)
2020
2021 CURLOPT_MAX_RECV_SPEED_LARGE
2022 Pass a curl_off_t as parameter. If a download exceeds this
2023 speed (counted in bytes per second) on cumulative average during
2024 the transfer, the transfer will pause to keep the average rate
2025 less than or equal to the parameter value. Defaults to unlimited
2026 speed. (Added in 7.15.5)
2027
2028 CURLOPT_MAXCONNECTS
2029 Pass a long. The set number will be the persistent connection
2030 cache size. The set amount will be the maximum amount of simul‐
2031 taneously open connections that libcurl may cache in this easy
2032 handle. Default is 5, and there isn't much point in changing
2033 this value unless you are perfectly aware of how this works and
2034 changes libcurl's behaviour. This concerns connections using any
2035 of the protocols that support persistent connections.
2036
2037 When reaching the maximum limit, curl closes the oldest one in
2038 the cache to prevent increasing the number of open connections.
2039
2040 If you already have performed transfers with this curl handle,
2041 setting a smaller MAXCONNECTS than before may cause open connec‐
2042 tions to get closed unnecessarily.
2043
2044 If you add this easy handle to a multi handle, this setting is
2045 not acknowledged, and you must instead use curl_multi_setopt(3)
2046 and the CURLMOPT_MAXCONNECTS option.
2047
2048 CURLOPT_CLOSEPOLICY
2049 (Obsolete) This option does nothing.
2050
2051 CURLOPT_FRESH_CONNECT
2052 Pass a long. Set to 1 to make the next transfer use a new
2053 (fresh) connection by force. If the connection cache is full
2054 before this connection, one of the existing connections will be
2055 closed as according to the selected or default policy. This
2056 option should be used with caution and only if you understand
2057 what it does. Set this to 0 to have libcurl attempt re-using an
2058 existing connection (default behavior).
2059
2060 CURLOPT_FORBID_REUSE
2061 Pass a long. Set to 1 to make the next transfer explicitly close
2062 the connection when done. Normally, libcurl keeps all connec‐
2063 tions alive when done with one transfer in case a succeeding one
2064 follows that can re-use them. This option should be used with
2065 caution and only if you understand what it does. Set to 0 to
2066 have libcurl keep the connection open for possible later re-use
2067 (default behavior).
2068
2069 CURLOPT_CONNECTTIMEOUT
2070 Pass a long. It should contain the maximum time in seconds that
2071 you allow the connection to the server to take. This only lim‐
2072 its the connection phase, once it has connected, this option is
2073 of no more use. Set to zero to disable connection timeout (it
2074 will then only timeout on the system's internal timeouts). See
2075 also the CURLOPT_TIMEOUT option.
2076
2077 In unix-like systems, this might cause signals to be used unless
2078 CURLOPT_NOSIGNAL is set.
2079
2080 CURLOPT_CONNECTTIMEOUT_MS
2081 Like CURLOPT_CONNECTTIMEOUT but takes the number of milliseconds
2082 instead. If libcurl is built to use the standard system name
2083 resolver, that portion of the connect will still use full-second
2084 resolution for timeouts with a minimum timeout allowed of one
2085 second. (Added in 7.16.2)
2086
2087 CURLOPT_IPRESOLVE
2088 Allows an application to select what kind of IP addresses to use
2089 when resolving host names. This is only interesting when using
2090 host names that resolve addresses using more than one version of
2091 IP. The allowed values are:
2092
2093 CURL_IPRESOLVE_WHATEVER
2094 Default, resolves addresses to all IP versions that your
2095 system allows.
2096
2097 CURL_IPRESOLVE_V4
2098 Resolve to IPv4 addresses.
2099
2100 CURL_IPRESOLVE_V6
2101 Resolve to IPv6 addresses.
2102
2103 CURLOPT_CONNECT_ONLY
2104 Pass a long. If the parameter equals 1, it tells the library to
2105 perform all the required proxy authentication and connection
2106 setup, but no data transfer. This option is useful only on HTTP
2107 URLs.
2108
2109 This option is useful with the CURLINFO_LASTSOCKET option to
2110 curl_easy_getinfo(3). The library can set up the connection and
2111 then the application can obtain the most recently used socket
2112 for special data transfers. (Added in 7.15.2)
2113
2115 CURLOPT_SSLCERT
2116 Pass a pointer to a zero terminated string as parameter. The
2117 string should be the file name of your certificate. The default
2118 format is "PEM" and can be changed with CURLOPT_SSLCERTTYPE.
2119
2120 With NSS this is the nickname of the certificate you wish to
2121 authenticate with.
2122
2123 CURLOPT_SSLCERTTYPE
2124 Pass a pointer to a zero terminated string as parameter. The
2125 string should be the format of your certificate. Supported for‐
2126 mats are "PEM" and "DER". (Added in 7.9.3)
2127
2128 CURLOPT_SSLKEY
2129 Pass a pointer to a zero terminated string as parameter. The
2130 string should be the file name of your private key. The default
2131 format is "PEM" and can be changed with CURLOPT_SSLKEYTYPE.
2132
2133 CURLOPT_SSLKEYTYPE
2134 Pass a pointer to a zero terminated string as parameter. The
2135 string should be the format of your private key. Supported for‐
2136 mats are "PEM", "DER" and "ENG".
2137
2138 The format "ENG" enables you to load the private key from a
2139 crypto engine. In this case CURLOPT_SSLKEY is used as an identi‐
2140 fier passed to the engine. You have to set the crypto engine
2141 with CURLOPT_SSLENGINE. "DER" format key file currently does
2142 not work because of a bug in OpenSSL.
2143
2144 CURLOPT_KEYPASSWD
2145 Pass a pointer to a zero terminated string as parameter. It will
2146 be used as the password required to use the CURLOPT_SSLKEY or
2147 CURLOPT_SSH_PRIVATE_KEYFILE private key. You never needed a
2148 pass phrase to load a certificate but you need one to load your
2149 private key.
2150
2151 (This option was known as CURLOPT_SSLKEYPASSWD up to 7.16.4 and
2152 CURLOPT_SSLCERTPASSWD up to 7.9.2)
2153
2154 CURLOPT_SSLENGINE
2155 Pass a pointer to a zero terminated string as parameter. It will
2156 be used as the identifier for the crypto engine you want to use
2157 for your private key.
2158
2159 If the crypto device cannot be loaded, CURLE_SSL_ENGINE_NOTFOUND
2160 is returned.
2161
2162 CURLOPT_SSLENGINE_DEFAULT
2163 Sets the actual crypto engine as the default for (asymmetric)
2164 crypto operations.
2165
2166 If the crypto device cannot be set, CURLE_SSL_ENGINE_SETFAILED
2167 is returned.
2168
2169 Even though this option doesn't need any parameter, in some con‐
2170 figurations curl_easy_setopt might be defined as a macro taking
2171 exactly three arguments. Therefore, it's recommended to pass 1
2172 as parameter to this option.
2173
2174 CURLOPT_SSLVERSION
2175 Pass a long as parameter to control what version of SSL/TLS to
2176 attempt to use. The available options are:
2177
2178 CURL_SSLVERSION_DEFAULT
2179 The default action. This will attempt to figure out the
2180 remote SSL protocol version, i.e. either SSLv3 or TLSv1
2181 (but not SSLv2, which became disabled by default with
2182 7.18.1).
2183
2184 CURL_SSLVERSION_TLSv1
2185 Force TLSv1
2186
2187 CURL_SSLVERSION_SSLv2
2188 Force SSLv2
2189
2190 CURL_SSLVERSION_SSLv3
2191 Force SSLv3
2192
2193 CURLOPT_SSL_VERIFYPEER
2194 Pass a long as parameter.
2195
2196 This option determines whether curl verifies the authenticity of
2197 the peer's certificate. A value of 1 means curl verifies; zero
2198 means it doesn't. The default is nonzero, but before 7.10, it
2199 was zero.
2200
2201 When negotiating an SSL connection, the server sends a certifi‐
2202 cate indicating its identity. Curl verifies whether the cer‐
2203 tificate is authentic, i.e. that you can trust that the server
2204 is who the certificate says it is. This trust is based on a
2205 chain of digital signatures, rooted in certification authority
2206 (CA) certificates you supply. As of 7.10, curl installs a
2207 default bundle of CA certificates and you can specify alternate
2208 certificates with the CURLOPT_CAINFO option or the CURLOPT_CAP‐
2209 ATH option.
2210
2211 When CURLOPT_SSL_VERIFYPEER is nonzero, and the verification
2212 fails to prove that the certificate is authentic, the connection
2213 fails. When the option is zero, the connection succeeds regard‐
2214 less.
2215
2216 Authenticating the certificate is not by itself very useful.
2217 You typically want to ensure that the server, as authentically
2218 identified by its certificate, is the server you mean to be
2219 talking to. Use CURLOPT_SSL_VERIFYHOST to control that.
2220
2221 CURLOPT_CAINFO
2222 Pass a char * to a zero terminated string naming a file holding
2223 one or more certificates to verify the peer with. This makes
2224 sense only when used in combination with the CURLOPT_SSL_VERI‐
2225 FYPEER option. If CURLOPT_SSL_VERIFYPEER is zero, CUR‐
2226 LOPT_CAINFO need not even indicate an accessible file.
2227
2228 This option is by default set to the system path where libcurl's
2229 cacert bundle is assumed to be stored, as established at build
2230 time.
2231
2232 When built against NSS, this is the directory that the NSS cer‐
2233 tificate database resides in.
2234
2235 CURLOPT_ISSUERCERT
2236 Pass a char * to a zero terminated string naming a file holding
2237 a CA certificate in PEM format. If the option is set, an addi‐
2238 tional check against the peer certificate is performed to verify
2239 the issuer is indeed the one associated with the certificate
2240 provided by the option. This additional check is useful in
2241 multi-level PKI where one needs to enforce that the peer cer‐
2242 tificate is from a specific branch of the tree.
2243
2244 This option makes sense only when used in combination with the
2245 CURLOPT_SSL_VERIFYPEER option. Otherwise, the result of the
2246 check is not considered as failure.
2247
2248 A specific error code (CURLE_SSL_ISSUER_ERROR) is defined with
2249 the option, which is returned if the setup of the SSL/TLS ses‐
2250 sion has failed due to a mismatch with the issuer of peer cer‐
2251 tificate (CURLOPT_SSL_VERIFYPEER has to be set too for the check
2252 to fail). (Added in 7.19.0)
2253
2254 CURLOPT_CAPATH
2255 Pass a char * to a zero terminated string naming a directory
2256 holding multiple CA certificates to verify the peer with. The
2257 certificate directory must be prepared using the openssl
2258 c_rehash utility. This makes sense only when used in combination
2259 with the CURLOPT_SSL_VERIFYPEER option. If CURLOPT_SSL_VERI‐
2260 FYPEER is zero, CURLOPT_CAPATH need not even indicate an acces‐
2261 sible path. The CURLOPT_CAPATH function apparently does not
2262 work in Windows due to some limitation in openssl. This option
2263 is OpenSSL-specific and does nothing if libcurl is built to use
2264 GnuTLS.
2265
2266 CURLOPT_CRLFILE
2267 Pass a char * to a zero terminated string naming a file with the
2268 concatenation of CRL (in PEM format) to use in the certificate
2269 validation that occurs during the SSL exchange.
2270
2271 When curl is built to use NSS or GnuTLS, there is no way to
2272 influence the use of CRL passed to help in the verification
2273 process. When libcurl is built with OpenSSL support,
2274 X509_V_FLAG_CRL_CHECK and X509_V_FLAG_CRL_CHECK_ALL are both
2275 set, requiring CRL check against all the elements of the cer‐
2276 tificate chain if a CRL file is passed.
2277
2278 This option makes sense only when used in combination with the
2279 CURLOPT_SSL_VERIFYPEER option.
2280
2281 A specific error code (CURLE_SSL_CRL_BADFILE) is defined with
2282 the option. It is returned when the SSL exchange fails because
2283 the CRL file cannot be loaded. A failure in certificate verifi‐
2284 cation due to a revocation information found in the CRL does not
2285 trigger this specific error. (Added in 7.19.0)
2286
2287 CURLOPT_CERTINFO
2288 Pass a long set to 1 to enable libcurl's certificate chain info
2289 gatherer. With this enabled, libcurl (if built with OpenSSL)
2290 will extract lots of information and data about the certificates
2291 in the certificate chain used in the SSL connection. This data
2292 is then possible to extract after a transfer using
2293 curl_easy_getinfo(3) and its option CURLINFO_CERTINFO. (Added in
2294 7.19.1)
2295
2296 CURLOPT_RANDOM_FILE
2297 Pass a char * to a zero terminated file name. The file will be
2298 used to read from to seed the random engine for SSL. The more
2299 random the specified file is, the more secure the SSL connection
2300 will become.
2301
2302 CURLOPT_EGDSOCKET
2303 Pass a char * to the zero terminated path name to the Entropy
2304 Gathering Daemon socket. It will be used to seed the random
2305 engine for SSL.
2306
2307 CURLOPT_SSL_VERIFYHOST
2308 Pass a long as parameter.
2309
2310 This option determines whether libcurl verifies that the server
2311 cert is for the server it is known as.
2312
2313 When negotiating a SSL connection, the server sends a certifi‐
2314 cate indicating its identity.
2315
2316 When CURLOPT_SSL_VERIFYHOST is 2, that certificate must indicate
2317 that the server is the server to which you meant to connect, or
2318 the connection fails.
2319
2320 Curl considers the server the intended one when the Common Name
2321 field or a Subject Alternate Name field in the certificate
2322 matches the host name in the URL to which you told Curl to con‐
2323 nect.
2324
2325 When the value is 1, the certificate must contain a Common Name
2326 field, but it doesn't matter what name it says. (This is not
2327 ordinarily a useful setting).
2328
2329 When the value is 0, the connection succeeds regardless of the
2330 names in the certificate.
2331
2332 The default, since 7.10, is 2.
2333
2334 This option controls checking the server's claimed identity.
2335 The server could be lying. To control lying, see CUR‐
2336 LOPT_SSL_VERIFYPEER.
2337
2338 CURLOPT_SSL_CIPHER_LIST
2339 Pass a char *, pointing to a zero terminated string holding the
2340 list of ciphers to use for the SSL connection. The list must be
2341 syntactically correct, it consists of one or more cipher strings
2342 separated by colons. Commas or spaces are also acceptable sepa‐
2343 rators but colons are normally used, !, - and + can be used as
2344 operators.
2345
2346 For OpenSSL and GnuTLS valid examples of cipher lists include
2347 'RC4-SHA', ´SHA1+DES´, 'TLSv1' and 'DEFAULT'. The default list
2348 is normally set when you compile OpenSSL.
2349
2350 You'll find more details about cipher lists on this URL:
2351 http://www.openssl.org/docs/apps/ciphers.html
2352
2353 For NSS, valid examples of cipher lists include
2354 'rsa_rc4_128_md5', ´rsa_aes_128_sha´, etc. With NSS you don't
2355 add/remove ciphers. If one uses this option then all known
2356 ciphers are disabled and only those passed in are enabled.
2357
2358 You'll find more details about the NSS cipher lists on this URL:
2359 http://directory.fedora.redhat.com/docs/mod_nss.html#Directives
2360
2361
2362 CURLOPT_SSL_SESSIONID_CACHE
2363 Pass a long set to 0 to disable libcurl's use of SSL session-ID
2364 caching. Set this to 1 to enable it. By default all transfers
2365 are done using the cache. While nothing ever should get hurt by
2366 attempting to reuse SSL session-IDs, there seem to be broken SSL
2367 implementations in the wild that may require you to disable this
2368 in order for you to succeed. (Added in 7.16.0)
2369
2370 CURLOPT_KRBLEVEL
2371 Pass a char * as parameter. Set the kerberos security level for
2372 FTP; this also enables kerberos awareness. This is a string,
2373 'clear', 'safe', 'confidential' or 'private'. If the string is
2374 set but doesn't match one of these, 'private' will be used. Set
2375 the string to NULL to disable kerberos support for FTP.
2376
2377 (This option was known as CURLOPT_KRB4LEVEL up to 7.16.3)
2378
2379 CURLOPT_GSSAPI_DELEGATION
2380 Set the parameter to CURLGSSAPI_DELEGATION_FLAG to allow uncon‐
2381 ditional GSSAPI credential delegation. The delegation is dis‐
2382 abled by default since 7.21.7. Set the parameter to CURLGSS‐
2383 API_DELEGATION_POLICY_FLAG to delegate only if the OK-AS-DELE‐
2384 GATE flag is set in the service ticket in case this feature is
2385 supported by the GSSAPI implementation and the definition of
2386 GSS_C_DELEG_POLICY_FLAG was available at compile-time. (Added
2387 in 7.21.8)
2388
2390 CURLOPT_SSH_AUTH_TYPES
2391 Pass a long set to a bitmask consisting of one or more of
2392 CURLSSH_AUTH_PUBLICKEY, CURLSSH_AUTH_PASSWORD,
2393 CURLSSH_AUTH_HOST, CURLSSH_AUTH_KEYBOARD. Set CURLSSH_AUTH_ANY
2394 to let libcurl pick one. (Added in 7.16.1)
2395
2396 CURLOPT_SSH_HOST_PUBLIC_KEY_MD5
2397 Pass a char * pointing to a string containing 32 hexadecimal
2398 digits. The string should be the 128 bit MD5 checksum of the
2399 remote host's public key, and libcurl will reject the connection
2400 to the host unless the md5sums match. This option is only for
2401 SCP and SFTP transfers. (Added in 7.17.1)
2402
2403 CURLOPT_SSH_PUBLIC_KEYFILE
2404 Pass a char * pointing to a file name for your public key. If
2405 not used, libcurl defaults to using ~/.ssh/id_dsa.pub. (Added
2406 in 7.16.1)
2407
2408 CURLOPT_SSH_PRIVATE_KEYFILE
2409 Pass a char * pointing to a file name for your private key. If
2410 not used, libcurl defaults to using ~/.ssh/id_dsa. If the file
2411 is password-protected, set the password with CURLOPT_KEYPASSWD.
2412 (Added in 7.16.1)
2413
2414 CURLOPT_SSH_KNOWNHOSTS
2415 Pass a pointer to a zero terminated string holding the file name
2416 of the known_host file to use. The known_hosts file should use
2417 the OpenSSH file format as supported by libssh2. If this file is
2418 specified, libcurl will only accept connections with hosts that
2419 are known and present in that file, with a matching public key.
2420 Use CURLOPT_SSH_KEYFUNCTION to alter the default behavior on
2421 host and key (mis)matching. (Added in 7.19.6)
2422
2423 CURLOPT_SSH_KEYFUNCTION
2424 Pass a pointer to a curl_sshkeycallback function. It gets called
2425 when the known_host matching has been done, to allow the appli‐
2426 cation to act and decide for libcurl how to proceed. It gets
2427 passed the CURL handle, the key from the known_hosts file, the
2428 key from the remote site, info from libcurl on the matching sta‐
2429 tus and a custom pointer (set with CURLOPT_SSH_KEYDATA). It MUST
2430 return one of the following return codes to tell libcurl how to
2431 act:
2432
2433 CURLKHSTAT_FINE_ADD_TO_FILE
2434 The host+key is accepted and libcurl will append it to
2435 the known_hosts file before continuing with the connec‐
2436 tion. This will also add the host+key combo to the
2437 known_host pool kept in memory if it wasn't already
2438 present there. The adding of data to the file is done by
2439 completely replacing the file with a new copy, so the
2440 permissions of the file must allow this.
2441
2442 CURLKHSTAT_FINE
2443 The host+key is accepted libcurl will continue with the
2444 connection. This will also add the host+key combo to the
2445 known_host pool kept in memory if it wasn't already
2446 present there.
2447
2448 CURLKHSTAT_REJECT
2449 The host+key is rejected. libcurl will deny the connec‐
2450 tion to continue and it will be closed.
2451
2452 CURLKHSTAT_DEFER
2453 The host+key is rejected, but the SSH connection is asked
2454 to be kept alive. This feature could be used when the
2455 app wants to somehow return back and act on the host+key
2456 situation and then retry without needing the overhead of
2457 setting it up from scratch again.
2458 (Added in 7.19.6)
2459
2460 CURLOPT_SSH_KEYDATA
2461 Pass a void * as parameter. This pointer will be passed along
2462 verbatim to the callback set with CURLOPT_SSH_KEYFUNCTION.
2463 (Added in 7.19.6)
2464
2466 CURLOPT_PRIVATE
2467 Pass a void * as parameter, pointing to data that should be
2468 associated with this curl handle. The pointer can subsequently
2469 be retrieved using curl_easy_getinfo(3) with the CURLINFO_PRI‐
2470 VATE option. libcurl itself does nothing with this data. (Added
2471 in 7.10.3)
2472
2473 CURLOPT_SHARE
2474 Pass a share handle as a parameter. The share handle must have
2475 been created by a previous call to curl_share_init(3). Setting
2476 this option, will make this curl handle use the data from the
2477 shared handle instead of keeping the data to itself. This
2478 enables several curl handles to share data. If the curl handles
2479 are used simultaneously in multiple threads, you MUST use the
2480 locking methods in the share handle. See curl_share_setopt(3)
2481 for details.
2482
2483 If you add a share that is set to share cookies, your easy han‐
2484 dle will use that cookie cache and get the cookie engine
2485 enabled. If you unshare an object that was using cookies (or
2486 change to another object that doesn't share cookies), the easy
2487 handle will get its cookie engine disabled.
2488
2489 Data that the share object is not set to share will be dealt
2490 with the usual way, as if no share was used.
2491
2492 CURLOPT_NEW_FILE_PERMS
2493 Pass a long as a parameter, containing the value of the permis‐
2494 sions that will be assigned to newly created files on the remote
2495 server. The default value is 0644, but any valid value can be
2496 used. The only protocols that can use this are sftp://, scp://,
2497 and file://. (Added in 7.16.4)
2498
2499 CURLOPT_NEW_DIRECTORY_PERMS
2500 Pass a long as a parameter, containing the value of the permis‐
2501 sions that will be assigned to newly created directories on the
2502 remote server. The default value is 0755, but any valid value
2503 can be used. The only protocols that can use this are sftp://,
2504 scp://, and file://. (Added in 7.16.4)
2505
2507 CURLOPT_TELNETOPTIONS
2508 Provide a pointer to a curl_slist with variables to pass to the
2509 telnet negotiations. The variables should be in the format
2510 <option=value>. libcurl supports the options 'TTYPE', 'XDISPLOC'
2511 and 'NEW_ENV'. See the TELNET standard for details.
2512
2514 CURLE_OK (zero) means that the option was set properly, non-zero means
2515 an error occurred as <curl/curl.h> defines. See the libcurl-errors(3)
2516 man page for the full list with descriptions.
2517
2518 If you try to set an option that libcurl doesn't know about, perhaps
2519 because the library is too old to support it or the option was removed
2520 in a recent version, this function will return CURLE_FAILED_INIT.
2521
2523 curl_easy_init(3), curl_easy_cleanup(3), curl_easy_reset(3)
2524
2525
2526
2527libcurl 7.20.0 1 Jan 2010 curl_easy_setopt(3)