author | Michael Krelin <hacker@klever.net> | 2007-11-26 21:14:28 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-11-26 21:14:28 (UTC) |
commit | 34dcd4dd9af494eab2f6e47498c270d27954bf19 (patch) (side-by-side diff) | |
tree | 19eeac758bf09905e9e55a24fa2494930ee5c890 /lib/curl.cc | |
parent | d788db9c490575e63506ce502a2f089eaaa624ee (diff) | |
download | libopkele-34dcd4dd9af494eab2f6e47498c270d27954bf19.zip libopkele-34dcd4dd9af494eab2f6e47498c270d27954bf19.tar.gz libopkele-34dcd4dd9af494eab2f6e47498c270d27954bf19.tar.bz2 |
encapsulated write functionality into curl_t
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | lib/curl.cc | 12 |
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 { (r=easy_setopt(CURLOPT_FOLLOWLOCATION,1)) || (r=easy_setopt(CURLOPT_MAXREDIRS,5)) || (r=easy_setopt(CURLOPT_DNS_CACHE_TIMEOUT,120)) || (r=easy_setopt(CURLOPT_DNS_USE_GLOBAL_CACHE,1)) || (r=easy_setopt(CURLOPT_USERAGENT,PACKAGE_NAME"/"PACKAGE_SRC_VERSION)) || (r=easy_setopt(CURLOPT_TIMEOUT,20)) #ifdef DISABLE_CURL_SSL_VERIFYHOST || (r=easy_setopt(CURLOPT_SSL_VERIFYHOST,0)) #endif #ifdef DISABLE_CURL_SSL_VERIFYPEER || (r=easy_setopt(CURLOPT_SSL_VERIFYPEER,0)) #endif ; return r; } + static size_t _write(void *p,size_t s,size_t nm,void *stream) { + return ((curl_t*)stream)->write(p,s,nm); + } + + CURLcode curl_t::set_write() { + assert(_c); + CURLcode r; + (r = easy_setopt(CURLOPT_WRITEDATA,this)) + || (r = easy_setopt(CURLOPT_WRITEFUNCTION,_write)); + return r; + } + } } |