1. curL 下载Https 网页的内容 编译的libcurl 需支持ssl
curl_easy_setopt(handle,CURLOPT_CAINFO,"ca.crt");
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 1L);
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 1L);
2. curl 的 easy_init 等函数是thread_safe,只需要保证在每个线程里面初始化curl的库函数即可。
test_curl(){
curl_easy_init();
.....
curl_easy_cleanup();
}
boost::thread n1(test_curl);
boost::thread n2(test_curl);
boost::thread n3(test_curl);
boost::thread n4(test_curl);
boost::thread n5(test_curl);
......
n1.join();
n2.join();
.........
--> OK
3. using of curl lib
curl = curl_easy_init
curl_easy_cleanup(curl);
curl_easy_reset() --> reset curl handle to initialize status
4. curl_easy_getinfo
can get the content-length of Upload/Download
current size of Upload/Download
5. curl_easy_duphandle
it dump a new handler with the same options as the previous one, u also can use it independently, but two handler use the only one options memory.
u 'd better not use the function if u not enough reason.
6. curl_slist_append
struct curl_slist * curl_slist_append(struct curl_slist * list, const char * string)
save the string into the slist;
same function as parameters of readv(), sendv()
see also:
curl_slist_free_all(struct curl_slist * list);
7. curl API 分类及关系
1) curl_easy 系列
2) curl_multi系列
3) curl_shared系列
4) Portable helpFunction
1) curl_easy 系列 如上
2) curl_multi
使用select类似的函数,支持同时处理多个网络通信状态,每一个handle是一个curl_easyhandle
3) curl_shared ????
to use the shared data in multi-thread environment
4)Help Function
4.1) curl_slist string list
4.2) curl_mprintf printf
4.3) curl_form Gen the FormData
4.4) curl_escape URL Encoding&Decoding
4.5) curl_getdate
4.6) curl_getenv
curl_easy_setopt(handle,CURLOPT_CAINFO,"ca.crt");
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 1L);
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 1L);
2. curl 的 easy_init 等函数是thread_safe,只需要保证在每个线程里面初始化curl的库函数即可。
test_curl(){
curl_easy_init();
.....
curl_easy_cleanup();
}
boost::thread n1(test_curl);
boost::thread n2(test_curl);
boost::thread n3(test_curl);
boost::thread n4(test_curl);
boost::thread n5(test_curl);
......
n1.join();
n2.join();
.........
--> OK
3. using of curl lib
curl = curl_easy_init
curl_easy_cleanup(curl);
curl_easy_reset() --> reset curl handle to initialize status
4. curl_easy_getinfo
can get the content-length of Upload/Download
current size of Upload/Download
5. curl_easy_duphandle
it dump a new handler with the same options as the previous one, u also can use it independently, but two handler use the only one options memory.
u 'd better not use the function if u not enough reason.
6. curl_slist_append
struct curl_slist * curl_slist_append(struct curl_slist * list, const char * string)
save the string into the slist;
same function as parameters of readv(), sendv()
see also:
curl_slist_free_all(struct curl_slist * list);
7. curl API 分类及关系
1) curl_easy 系列
2) curl_multi系列
3) curl_shared系列
4) Portable helpFunction
1) curl_easy 系列 如上
2) curl_multi
使用select类似的函数,支持同时处理多个网络通信状态,每一个handle是一个curl_easyhandle
3) curl_shared ????
to use the shared data in multi-thread environment
4)Help Function
4.1) curl_slist string list
4.2) curl_mprintf printf
4.3) curl_form Gen the FormData
4.4) curl_escape URL Encoding&Decoding
4.5) curl_getdate
4.6) curl_getenv