Revert "Update to 7.40.1"
[platform/upstream/curl.git] / docs / libcurl / curl_multi_setopt.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
9 .\" *
10 .\" * This software is licensed as described in the file COPYING, which
11 .\" * you should have received as part of this distribution. The terms
12 .\" * are also available at http://curl.haxx.se/docs/copyright.html.
13 .\" *
14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 .\" * copies of the Software, and permit persons to whom the Software is
16 .\" * furnished to do so, under the terms of the COPYING file.
17 .\" *
18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 .\" * KIND, either express or implied.
20 .\" *
21 .\" **************************************************************************
22 .TH curl_multi_setopt 3 "10 Oct 2006" "libcurl 7.16.0" "libcurl Manual"
23 .SH NAME
24 curl_multi_setopt \- set options for a curl multi handle
25 .SH SYNOPSIS
26 #include <curl/curl.h>
27
28 CURLMcode curl_multi_setopt(CURLM * multi_handle, CURLMoption option, param);
29 .SH DESCRIPTION
30 curl_multi_setopt() is used to tell a libcurl multi handle how to behave. By
31 using the appropriate options to \fIcurl_multi_setopt(3)\fP, you can change
32 libcurl's behaviour when using that multi handle.  All options are set with
33 the \fIoption\fP followed by the parameter \fIparam\fP. That parameter can be
34 a \fBlong\fP, a \fBfunction pointer\fP, an \fBobject pointer\fP or a
35 \fBcurl_off_t\fP type, depending on what the specific option expects. Read
36 this manual carefully as bad input values may cause libcurl to behave badly!
37 You can only set one option in each function call.
38
39 .SH OPTIONS
40 .IP CURLMOPT_SOCKETFUNCTION
41 Pass a pointer to a function matching the \fBcurl_socket_callback\fP
42 prototype. The \fIcurl_multi_socket_action(3)\fP function informs the
43 application about updates in the socket (file descriptor) status by doing
44 none, one, or multiple calls to the curl_socket_callback given in the
45 \fBparam\fP argument. They update the status with changes since the previous
46 time a \fIcurl_multi_socket(3)\fP function was called. If the given callback
47 pointer is NULL, no callback will be called. Set the callback's \fBuserp\fP
48 argument with \fICURLMOPT_SOCKETDATA\fP.  See \fIcurl_multi_socket(3)\fP for
49 more callback details.
50 .IP CURLMOPT_SOCKETDATA
51 Pass a pointer to whatever you want passed to the \fBcurl_socket_callback\fP's
52 fourth argument, the userp pointer. This is not used by libcurl but only
53 passed-thru as-is. Set the callback pointer with
54 \fICURLMOPT_SOCKETFUNCTION\fP.
55 .IP CURLMOPT_PIPELINING
56 Pass a long set to 1 to enable or 0 to disable. Enabling pipelining on a multi
57 handle will make it attempt to perform HTTP Pipelining as far as possible for
58 transfers using this handle. This means that if you add a second request that
59 can use an already existing connection, the second request will be \&"piped"
60 on the same connection rather than being executed in parallel. (Added in
61 7.16.0)
62 .IP CURLMOPT_TIMERFUNCTION
63 Pass a pointer to a function matching the \fBcurl_multi_timer_callback\fP
64 prototype: int curl_multi_timer_callback(CURLM *multi /* multi handle */,
65 long timeout_ms /* timeout in milliseconds */, void *userp /* TIMERDATA */).
66 This function will then be called when the timeout value
67 changes. The timeout value is at what latest time the application should call
68 one of the \&"performing" functions of the multi interface
69 (\fIcurl_multi_socket_action(3)\fP and \fIcurl_multi_perform(3)\fP) - to allow
70 libcurl to keep timeouts and retries etc to work. A timeout value of -1 means
71 that there is no timeout at all, and 0 means that the timeout is already
72 reached. Libcurl attempts to limit calling this only when the fixed future
73 timeout time actually changes. See also \fICURLMOPT_TIMERDATA\fP. The callback
74 should return 0 on success, and -1 on error. This
75 callback can be used instead of, or in addition to,
76 \fIcurl_multi_timeout(3)\fP. (Added in 7.16.0)
77 .IP CURLMOPT_TIMERDATA
78 Pass a pointer to whatever you want passed to the
79 \fBcurl_multi_timer_callback\fP's third argument, the userp pointer.  This is
80 not used by libcurl but only passed-thru as-is. Set the callback pointer with
81 \fICURLMOPT_TIMERFUNCTION\fP. (Added in 7.16.0)
82 .IP CURLMOPT_MAXCONNECTS
83 Pass a long. The set number will be used as the maximum amount of
84 simultaneously open connections that libcurl may keep in its connection cache
85 after completed use. By default libcurl will enlarge the size for each added
86 easy handle to make it fit 4 times the number of added easy handles.
87
88 By setting this option, you can prevent the cache size from growing beyond the
89 limit set by you.
90
91 When the cache is full, curl closes the oldest one in the cache to prevent the
92 number of open connections from increasing.
93
94 This option is for the multi handle's use only, when using the easy interface
95 you should instead use the \fICURLOPT_MAXCONNECTS(3)\fP option.
96
97 See \fICURLMOPT_MAX_TOTAL_CONNECTIONS\fP for limiting the number of active
98 connections.
99
100 (Added in 7.16.3)
101 .IP CURLMOPT_MAX_HOST_CONNECTIONS
102 Pass a long. The set number will be used as the maximum amount of
103 simultaneously open connections to a single host. For each new session to
104 a host, libcurl will open a new connection up to the limit set by
105 CURLMOPT_MAX_HOST_CONNECTIONS. When the limit is reached, the sessions will
106 be pending until there are available connections. If CURLMOPT_PIPELINING is
107 1, libcurl will try to pipeline if the host is capable of it.
108
109 The default value is 0, which means that there is no limit.
110 However, for backwards compatibility, setting it to 0 when CURLMOPT_PIPELINING
111 is 1 will not be treated as unlimited. Instead it will open only 1 connection
112 and try to pipeline on it.
113
114 (Added in 7.30.0)
115 .IP CURLMOPT_MAX_PIPELINE_LENGTH
116 Pass a long. The set number will be used as the maximum amount of requests
117 in a pipelined connection. When this limit is reached, libcurl will use another
118 connection to the same host (see CURLMOPT_MAX_HOST_CONNECTIONS), or queue the
119 requests until one of the pipelines to the host is ready to accept a request.
120 Thus, the total number of requests in-flight is CURLMOPT_MAX_HOST_CONNECTIONS *
121 CURLMOPT_MAX_PIPELINE_LENGTH.
122 The default value is 5.
123
124 (Added in 7.30.0)
125 .IP CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE
126 Pass a long. If a pipelined connection is currently processing a request
127 with a Content-Length larger than CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, that
128 connection will not be considered for additional requests, even if it is
129 shorter than CURLMOPT_MAX_PIPELINE_LENGTH.
130 The default value is 0, which means that the penalization is inactive.
131
132 (Added in 7.30.0)
133 .IP CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE
134 Pass a long. If a pipelined connection is currently processing a
135 chunked (Transfer-encoding: chunked) request with a current chunk length
136 larger than CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, that connection will not be
137 considered for additional requests, even if it is shorter than
138 CURLMOPT_MAX_PIPELINE_LENGTH.
139 The default value is 0, which means that the penalization is inactive.
140
141 (Added in 7.30.0)
142 .IP CURLMOPT_PIPELINING_SITE_BL
143 Pass an array of char *, ending with NULL. This is a list of sites that are
144 blacklisted from pipelining, i.e sites that are known to not support HTTP
145 pipelining. The array is copied by libcurl.
146
147 The default value is NULL, which means that there is no blacklist.
148
149 Pass a NULL pointer to clear the blacklist.
150
151 Example:
152
153 .nf
154   site_blacklist[] =
155   {
156     "www.haxx.se",
157     "www.example.com:1234",
158     NULL
159   };
160
161   curl_multi_setopt(m, CURLMOPT_PIPELINE_SITE_BL, site_blacklist);
162 .fi
163
164 (Added in 7.30.0)
165 .IP CURLMOPT_PIPELINING_SERVER_BL
166 Pass an array of char *, ending with NULL. This is a list of server types
167 prefixes (in the Server: HTTP header) that are blacklisted from pipelining,
168 i.e server types that are known to not support HTTP pipelining. The array is
169 copied by libcurl.
170
171 Note that the comparison matches if the Server: header begins with the string
172 in the blacklist, i.e "Server: Ninja 1.2.3" and "Server: Ninja 1.4.0" can 
173 both be blacklisted by having "Ninja" in the backlist.
174
175 The default value is NULL, which means that there is no blacklist.
176
177 Pass a NULL pointer to clear the blacklist.
178
179 Example:
180
181 .nf
182   server_blacklist[] =
183   {
184     "Microsoft-IIS/6.0",
185     "nginx/0.8.54",
186     NULL
187   };
188
189   curl_multi_setopt(m, CURLMOPT_PIPELINE_SERVER_BL, server_blacklist);
190 .fi
191
192 (Added in 7.30.0)
193 .IP CURLMOPT_MAX_TOTAL_CONNECTIONS
194 Pass a long. The set number will be used as the maximum amount of
195 simultaneously open connections in total. For each new session, libcurl
196 will open a new connection up to the limit set by
197 CURLMOPT_MAX_TOTAL_CONNECTIONS. When the limit is reached, the sessions will
198 be pending until there are available connections. If CURLMOPT_PIPELINING is
199 1, libcurl will try to pipeline if the host is capable of it.
200
201 The default value is 0, which means that there is no limit.
202 However, for backwards compatibility, setting it to 0 when CURLMOPT_PIPELINING
203 is 1 will not be treated as unlimited. Instead it will open only 1 connection
204 and try to pipeline on it.
205
206 (Added in 7.30.0)
207 .SH RETURNS
208 The standard CURLMcode for multi interface error codes. Note that it returns a
209 CURLM_UNKNOWN_OPTION if you try setting an option that this version of libcurl
210 doesn't know of.
211 .SH AVAILABILITY
212 This function was added in libcurl 7.15.4.
213 .SH "SEE ALSO"
214 .BR curl_multi_cleanup "(3), " curl_multi_init "(3), "
215 .BR curl_multi_socket "(3), " curl_multi_info_read "(3)"