b95192b567f1f332df3618fcc5215d11c1abbe9f
[platform/upstream/curl.git] / docs / libcurl / curl_multi_setopt.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2  "http://www.w3.org/TR/html4/loose.dtd">
3 <html><head>
4 <title>curl_multi_setopt man page</title>
5 <meta name="generator" content="roffit">
6 <STYLE type="text/css">
7 P.level0 {
8  padding-left: 2em;
9 }
10
11 P.level1 {
12  padding-left: 4em;
13 }
14
15 P.level2 {
16  padding-left: 6em;
17 }
18
19 span.emphasis {
20  font-style: italic;
21 }
22
23 span.bold {
24  font-weight: bold;
25 }
26
27 span.manpage {
28  font-weight: bold;
29 }
30
31 h2.nroffsh {
32  background-color: #e0e0e0;
33 }
34
35 span.nroffip {
36  font-weight: bold;
37  font-size: 120%;
38  font-family: monospace;
39 }
40
41 p.roffit {
42  text-align: center;
43  font-size: 80%;
44 }
45 </STYLE>
46 </head><body>
47
48 <p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2>
49 <p class="level0">curl_multi_setopt - set options for a curl multi handle <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2>
50 <p class="level0">#include &lt;curl/curl.h&gt; 
51 <p class="level0">CURLMcode curl_multi_setopt(CURLM * multi_handle, CURLMoption option, param); <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2>
52 <p class="level0">curl_multi_setopt() is used to tell a libcurl multi handle how to behave. By using the appropriate options to <a class="emphasis" href="./curl_multi_setopt.html">curl_multi_setopt(3)</a>, you can change libcurl's behaviour when using that multi handle.  All options are set with the <span Class="emphasis">option</span> followed by the parameter <span Class="emphasis">param</span>. That parameter can be a <span Class="bold">long</span>, a <span Class="bold">function pointer</span>, an <span Class="bold">object pointer</span> or a <span Class="bold">curl_off_t</span> type, depending on what the specific option expects. Read this manual carefully as bad input values may cause libcurl to behave badly! You can only set one option in each function call. 
53 <p class="level0"><a name="OPTIONS"></a><h2 class="nroffsh">OPTIONS</h2>
54 <p class="level0">
55 <p class="level0"><a name="CURLMOPTSOCKETFUNCTION"></a><span class="nroffip">CURLMOPT_SOCKETFUNCTION</span> 
56 <p class="level1">Pass a pointer to a function matching the <span Class="bold">curl_socket_callback</span> prototype. The <a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> function informs the application about updates in the socket (file descriptor) status by doing none, one, or multiple calls to the curl_socket_callback given in the <span Class="bold">param</span> argument. They update the status with changes since the previous time a <a class="emphasis" href="./curl_multi_socket.html">curl_multi_socket(3)</a> function was called. If the given callback pointer is NULL, no callback will be called. Set the callback's <span Class="bold">userp</span> argument with <a class="emphasis" href="#CURLMOPTSOCKETDATA">CURLMOPT_SOCKETDATA</a>.  See <a class="emphasis" href="./curl_multi_socket.html">curl_multi_socket(3)</a> for more callback details. 
57 <p class="level0"><a name="CURLMOPTSOCKETDATA"></a><span class="nroffip">CURLMOPT_SOCKETDATA</span> 
58 <p class="level1">Pass a pointer to whatever you want passed to the <span Class="bold">curl_socket_callback</span>'s fourth argument, the userp pointer. This is not used by libcurl but only passed-thru as-is. Set the callback pointer with <a class="emphasis" href="#CURLMOPTSOCKETFUNCTION">CURLMOPT_SOCKETFUNCTION</a>. 
59 <p class="level0"><a name="CURLMOPTPIPELINING"></a><span class="nroffip">CURLMOPT_PIPELINING</span> 
60 <p class="level1">Pass a long set to 1 to enable or 0 to disable. Enabling pipelining on a multi handle will make it attempt to perform HTTP Pipelining as far as possible for transfers using this handle. This means that if you add a second request that can use an already existing connection, the second request will be "piped" on the same connection rather than being executed in parallel. (Added in 7.16.0) 
61 <p class="level0"><a name="CURLMOPTTIMERFUNCTION"></a><span class="nroffip">CURLMOPT_TIMERFUNCTION</span> 
62 <p class="level1">Pass a pointer to a function matching the <span Class="bold">curl_multi_timer_callback</span> prototype: int curl_multi_timer_callback(CURLM *multi /* multi handle */, long timeout_ms /* timeout in milliseconds */, void *userp /* TIMERDATA */). This function will then be called when the timeout value changes. The timeout value is at what latest time the application should call one of the "performing" functions of the multi interface (<a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> and <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a>) - to allow libcurl to keep timeouts and retries etc to work. A timeout value of -1 means that there is no timeout at all, and 0 means that the timeout is already reached. Libcurl attempts to limit calling this only when the fixed future timeout time actually changes. See also <a class="emphasis" href="#CURLMOPTTIMERDATA">CURLMOPT_TIMERDATA</a>. The callback should return 0 on success, and -1 on error. This callback can be used instead of, or in addition to, <a class="emphasis" href="./curl_multi_timeout.html">curl_multi_timeout(3)</a>. (Added in 7.16.0) 
63 <p class="level0"><a name="CURLMOPTTIMERDATA"></a><span class="nroffip">CURLMOPT_TIMERDATA</span> 
64 <p class="level1">Pass a pointer to whatever you want passed to the <span Class="bold">curl_multi_timer_callback</span>'s third argument, the userp pointer.  This is not used by libcurl but only passed-thru as-is. Set the callback pointer with <a class="emphasis" href="#CURLMOPTTIMERFUNCTION">CURLMOPT_TIMERFUNCTION</a>. (Added in 7.16.0) 
65 <p class="level0"><a name="CURLMOPTMAXCONNECTS"></a><span class="nroffip">CURLMOPT_MAXCONNECTS</span> 
66 <p class="level1">Pass a long. The set number will be used as the maximum amount of simultaneously open connections that libcurl may cache. Default is 10, and libcurl will enlarge the size for each added easy handle to make it fit 4 times the number of added easy handles. 
67 <p class="level1">By setting this option, you can prevent the cache size from growing beyond the limit set by you. 
68 <p class="level1">When the cache is full, curl closes the oldest one in the cache to prevent the number of open connections from increasing. 
69 <p class="level1">This option is for the multi handle's use only, when using the easy interface you should instead use the <span Class="emphasis">CURLOPT_MAXCONNECTS</span> option. 
70 <p class="level1">(Added in 7.16.3) 
71 <p class="level0"><a name="CURLMOPTMAXHOSTCONNECTIONS"></a><span class="nroffip">CURLMOPT_MAX_HOST_CONNECTIONS</span> 
72 <p class="level1">Pass a long. The set number will be used as the maximum amount of simultaneously open connections to a single host. For each new session to a host, libcurl will open a new connection up to the limit set by CURLMOPT_MAX_HOST_CONNECTIONS. When the limit is reached, the sessions will be pending until there are available connections. If CURLMOPT_PIPELINING is 1, libcurl will try to pipeline if the host is capable of it. 
73 <p class="level1">The default value is 0, which means that there is no limit. However, for backwards compatibility, setting it to 0 when CURLMOPT_PIPELINING is 1 will not be treated as unlimited. Instead it will open only 1 connection and try to pipeline on it. 
74 <p class="level1">(Added in 7.30.0) 
75 <p class="level0"><a name="CURLMOPTMAXPIPELINELENGTH"></a><span class="nroffip">CURLMOPT_MAX_PIPELINE_LENGTH</span> 
76 <p class="level1">Pass a long. The set number will be used as the maximum amount of requests in a pipelined connection. When this limit is reached, libcurl will use another connection to the same host (see CURLMOPT_MAX_HOST_CONNECTIONS), or queue the requests until one of the pipelines to the host is ready to accept a request. Thus, the total number of requests in-flight is CURLMOPT_MAX_HOST_CONNECTIONS * CURLMOPT_MAX_PIPELINE_LENGTH. The default value is 5. 
77 <p class="level1">(Added in 7.30.0) 
78 <p class="level0"><a name="CURLMOPTCONTENTLENGTHPENALTYSIZE"></a><span class="nroffip">CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE</span> 
79 <p class="level1">Pass a long. If a pipelined connection is currently processing a request with a Content-Length larger than CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, that connection will not be considered for additional requests, even if it is shorter than CURLMOPT_MAX_PIPELINE_LENGTH. The default value is 0, which means that the penalization is inactive. 
80 <p class="level1">(Added in 7.30.0) 
81 <p class="level0"><a name="CURLMOPTCHUNKLENGTHPENALTYSIZE"></a><span class="nroffip">CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE</span> 
82 <p class="level1">Pass a long. If a pipelined connection is currently processing a chunked (Transfer-encoding: chunked) request with a current chunk length larger than CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, that connection will not be considered for additional requests, even if it is shorter than CURLMOPT_MAX_PIPELINE_LENGTH. The default value is 0, which means that the penalization is inactive. 
83 <p class="level1">(Added in 7.30.0) 
84 <p class="level0"><a name="CURLMOPTPIPELININGSITEBL"></a><span class="nroffip">CURLMOPT_PIPELINING_SITE_BL</span> 
85 <p class="level1">Pass an array of char *, ending with NULL. This is a list of sites that are blacklisted from pipelining, i.e sites that are known to not support HTTP pipelining. The array is copied by libcurl. 
86 <p class="level1">The default value is NULL, which means that there is no blacklist. 
87 <p class="level1">Pass a NULL pointer to clear the blacklist. 
88 <p class="level1">Example: 
89 <p class="level1"><pre>
90 <p class="level1">&nbsp; site_blacklist[] =
91  &nbsp; {
92  &nbsp;   "www.haxx.se",
93  &nbsp;   "www.example.com:1234",
94  &nbsp;   NULL
95  &nbsp; };
96  <p class="level1">&nbsp; curl_multi_setopt(m, CURLMOPT_PIPELINE_SITE_BL, site_blacklist);
97  </pre>
98
99 <p class="level1">
100 <p class="level1">(Added in 7.30.0) 
101 <p class="level0"><a name="CURLMOPTPIPELININGSERVERBL"></a><span class="nroffip">CURLMOPT_PIPELINING_SERVER_BL</span> 
102 <p class="level1">Pass an array of char *, ending with NULL. This is a list of server types prefixes (in the Server: HTTP header) that are blacklisted from pipelining, i.e server types that are known to not support HTTP pipelining. The array is copied by libcurl. 
103 <p class="level1">Note that the comparison matches if the Server: header begins with the string in the blacklist, i.e "Server: Ninja 1.2.3" and "Server: Ninja 1.4.0" can  both be blacklisted by having "Ninja" in the backlist. 
104 <p class="level1">The default value is NULL, which means that there is no blacklist. 
105 <p class="level1">Pass a NULL pointer to clear the blacklist. 
106 <p class="level1">Example: 
107 <p class="level1"><pre>
108 <p class="level1">&nbsp; server_blacklist[] =
109  &nbsp; {
110  &nbsp;   "Microsoft-IIS/6.0",
111  &nbsp;   "nginx/0.8.54",
112  &nbsp;   NULL
113  &nbsp; };
114  <p class="level1">&nbsp; curl_multi_setopt(m, CURLMOPT_PIPELINE_SERVER_BL, server_blacklist);
115  </pre>
116
117 <p class="level1">
118 <p class="level1">(Added in 7.30.0) 
119 <p class="level0"><a name="CURLMOPTMAXTOTALCONNECTIONS"></a><span class="nroffip">CURLMOPT_MAX_TOTAL_CONNECTIONS</span> 
120 <p class="level1">Pass a long. The set number will be used as the maximum amount of simultaneously open connections in total. For each new session, libcurl will open a new connection up to the limit set by CURLMOPT_MAX_TOTAL_CONNECTIONS. When the limit is reached, the sessions will be pending until there are available connections. If CURLMOPT_PIPELINING is 1, libcurl will try to pipeline if the host is capable of it. 
121 <p class="level1">The default value is 0, which means that there is no limit. However, for backwards compatibility, setting it to 0 when CURLMOPT_PIPELINING is 1 will not be treated as unlimited. Instead it will open only 1 connection and try to pipeline on it. 
122 <p class="level1">(Added in 7.30.0) <a name="RETURNS"></a><h2 class="nroffsh">RETURNS</h2>
123 <p class="level0">The standard CURLMcode for multi interface error codes. Note that it returns a CURLM_UNKNOWN_OPTION if you try setting an option that this version of libcurl doesn't know of. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2>
124 <p class="level0">This function was added in libcurl 7.15.4. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2>
125 <p class="level0"><a class="manpage" href="./curl_multi_cleanup.html">curl_multi_cleanup (3)</a> <a class="manpage" href="./curl_multi_init.html">  curl_multi_init (3)</a> <span Class="manpage"> </span> <a class="manpage" href="./curl_multi_socket.html">curl_multi_socket (3)</a> <a class="manpage" href="./curl_multi_info_read.html">  curl_multi_info_read (3)</a> <p class="roffit">
126  This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>.
127 </body></html>