Concept Framework 1.0 documentation Contents | Index

standard.net.curl.curl_global_cleanup

Name Version Deprecated
curl_global_cleanup version 1.0 no

Prototype:
null-returned curl_global_cleanup()


Description:
This function releases resources acquired by curl_global_init.
You should call curl_global_cleanup once for each call you make to curl_global_init, after you are done using libcurl.
This function is not thread safe. You must not call it when any other thread in the program (i.e. a thread sharing the same memory) is running. This doesn't just mean no other thread that is using libcurl. Because curl_global_cleanup calls functions of other libraries that are similarly thread unsafe, it could conflict with any other thread that uses these other libraries.

Example:
import standard.net.curl

import standard.C.io


class Main {
var data="";
var header="";

function write_data(ptr, size, nmemb, stream) {
//echo "Stream: $stream\n";
if (stream==1001)
header+=ptr;
else
data+=ptr;
return size*nmemb;
}

function read_data(var ptr, size, nmemb, stream) {
echo typeof ptr;

for (var i=0;i<100;i++)
ptr+="x";

return size*nmemb;
}

function progress(clientp, dltotal, dlnow, ultotal, ulnow) {
echo "$dlnow/$dltotal bytes received \r";
}

function Main() {
curl_global_init(CURL_GLOBAL_ALL);

var curl_handle=curl_easy_init();

curl_easy_setopt(curl_handle, CURLOPT_PROGRESSFUNCTION, progress);
curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 0);


curl_easy_setopt(curl_handle, CURLOPT_URL, "http://curl.haxx.se");

curl_easy_setopt(curl_handle, CURLOPT_READFUNCTION, read_data);

curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, 1002);
curl_easy_setopt(curl_handle, CURLOPT_WRITEHEADER , 1001);


curl_easy_perform(curl_handle);
echo "\n\n";
curl_easy_getinfo(curl_handle, CURLINFO_SSL_ENGINES, var arr);
echo arr;

curl_easy_cleanup(curl_handle);

WriteFile(data,"data.html");
WriteFile(header,"data_header.txt");

}
}

Returns:
Returns nothing

Documented by Eduard Suica, generation time: Thu Oct 15 20:02:08 2009 GMT(c)2009 RadGs Software