[curl_easy_setopt] is used together with the [curlopt_*] methods. They are all used for the same purpose – to set different options for the curl operation.
For more information, look at the respective [curlopt_] method.
[curl_easy_setopt] sets options for an operation performed using a [curltoken]. It is used in conjunction with a method that starts with curlopt_.
[curl_easy_setopt] is used to tell libcurl how to behave. By using the appropriate options to [curl->set], you can change libcurl's behavior. All options are set with the option followed by a parameter. That parameter can be an integer, a string, an array, a byte variable or just null]. The type of the value depends on what the specific option expects. You can only set one option in each function call. A typical application uses many calls to [curl_easy_setopt] in the setup phase.
Options set with this function call are valid for all forthcoming transfers performed using this [curltoken] variable. The options are not in any way reset between transfers, so if you want subsequent transfers with different options, you must change them between the transfers. You can optionally reset all options back to internal default with [curl_easy_reset].
The [curltoken] is the return value from a [curl_easy_init] or [curl_easy_duphandle] call.
curl_easy_setopt('curltoken', 'curlopt_option', 'string value')
curl_easy_setopt('curltoken', 'curlopt_option', 'integer value')
curl_easy_setopt('curltoken', 'curlopt_option', 'null value')
curl_easy_setopt('curltoken', 'curlopt_option', 'array value')
curl_easy_setopt('curltoken', 'curlopt_option', 'bytes value')
Code
local(ctoken, err, data, headerBytes = bytes, bodyBytes = bytes, ready = false)
#ctoken = curl_easy_init
#err = curl_easy_setopt(#ctoken, curlopt_url, "ftp://ftp.sunet.se/pub/etext/")
#err = curl_easy_setopt(#ctoken, curlopt_ftplistonly, 1)
while(!#ready) => {
#data = curl_multi_perform(#ctoken)
#data->second->isa(::bytes) ? #headerBytes->append(#data->second)
#data->last->isa(::bytes) ? #bodyBytes->append(#data->last)
#ready = !#data->first
!#ready ? sleep(10)
}
#bodyBytes
Result
0Atte Finnish etext gutenberg hwb libellus mh ota runeberg wiretap-classic-library
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Recent Comments