[curl_easy_cleanup] ends a libcurl easy session.
It must be the last method to call for an easy session. It is the opposite of the [curl_easy_init] method and must be called with the same [curltoken] as input that the [curl_easy_init] call returned.
This will effectively close all connections this [curltoken] has used and possibly has kept open until now. Don't call this function if you intend to transfer more files.
Any uses of the [curltoken] after this function has been called are illegal. This kills the [curltoken] and all memory associated with it!
curl_easy_cleanup('curltoken')
Code
local(ctoken, err, data, headerBytes = bytes, bodyBytes = bytes, ready = false)
local(urllist = array('http://www.lassosoft.com/', 'http://downloads.lassosoft.com/', 'ftp://ftp.lassosoft.com'))
local(results = array)
iterate(#urllist, local('url'))
#ctoken = curl_easy_init
#err = curl_easy_setopt(#ctoken, curlopt_url, "http://www.lassosoft.com/")
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)
}
curl_easy_cleanup(#ctoken)
#results->insert(#headerBytes->split('\r\n')->first)
/iterate
//#headerBytes contains the http headers returned
//#bodyBytes contains the data returned from the request
#results //shows the status messages from each URL request
Result
array(HTTP/1.1 200 OK, HTTP/1.1 200 OK, HTTP/1.1 200 OK)
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