summaryrefslogtreecommitdiffabout
path: root/lib/curl.cc
authorMichael Krelin <hacker@klever.net>2007-11-26 21:14:28 (UTC)
committer Michael Krelin <hacker@klever.net>2007-11-26 21:14:28 (UTC)
commit34dcd4dd9af494eab2f6e47498c270d27954bf19 (patch) (unidiff)
tree19eeac758bf09905e9e55a24fa2494930ee5c890 /lib/curl.cc
parentd788db9c490575e63506ce502a2f089eaaa624ee (diff)
downloadlibopkele-34dcd4dd9af494eab2f6e47498c270d27954bf19.zip
libopkele-34dcd4dd9af494eab2f6e47498c270d27954bf19.tar.gz
libopkele-34dcd4dd9af494eab2f6e47498c270d27954bf19.tar.bz2
encapsulated write functionality into curl_t
Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (limited to 'lib/curl.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/curl.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/curl.cc b/lib/curl.cc
index 418aa79..3e69b47 100644
--- a/lib/curl.cc
+++ b/lib/curl.cc
@@ -24,19 +24,31 @@ namespace opkele {
24 (r=easy_setopt(CURLOPT_FOLLOWLOCATION,1)) 24 (r=easy_setopt(CURLOPT_FOLLOWLOCATION,1))
25 || (r=easy_setopt(CURLOPT_MAXREDIRS,5)) 25 || (r=easy_setopt(CURLOPT_MAXREDIRS,5))
26 || (r=easy_setopt(CURLOPT_DNS_CACHE_TIMEOUT,120)) 26 || (r=easy_setopt(CURLOPT_DNS_CACHE_TIMEOUT,120))
27 || (r=easy_setopt(CURLOPT_DNS_USE_GLOBAL_CACHE,1)) 27 || (r=easy_setopt(CURLOPT_DNS_USE_GLOBAL_CACHE,1))
28 || (r=easy_setopt(CURLOPT_USERAGENT,PACKAGE_NAME"/"PACKAGE_SRC_VERSION)) 28 || (r=easy_setopt(CURLOPT_USERAGENT,PACKAGE_NAME"/"PACKAGE_SRC_VERSION))
29 || (r=easy_setopt(CURLOPT_TIMEOUT,20)) 29 || (r=easy_setopt(CURLOPT_TIMEOUT,20))
30 #ifdefDISABLE_CURL_SSL_VERIFYHOST 30 #ifdefDISABLE_CURL_SSL_VERIFYHOST
31 || (r=easy_setopt(CURLOPT_SSL_VERIFYHOST,0)) 31 || (r=easy_setopt(CURLOPT_SSL_VERIFYHOST,0))
32#endif 32#endif
33 #ifdefDISABLE_CURL_SSL_VERIFYPEER 33 #ifdefDISABLE_CURL_SSL_VERIFYPEER
34 || (r=easy_setopt(CURLOPT_SSL_VERIFYPEER,0)) 34 || (r=easy_setopt(CURLOPT_SSL_VERIFYPEER,0))
35#endif 35#endif
36 ; 36 ;
37 return r; 37 return r;
38 } 38 }
39 39
40 static size_t _write(void *p,size_t s,size_t nm,void *stream) {
41 return ((curl_t*)stream)->write(p,s,nm);
42 }
43
44 CURLcode curl_t::set_write() {
45 assert(_c);
46 CURLcode r;
47 (r = easy_setopt(CURLOPT_WRITEDATA,this))
48 || (r = easy_setopt(CURLOPT_WRITEFUNCTION,_write));
49 return r;
50 }
51
40 } 52 }
41 53
42} 54}