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