- curl_easy_setopt ( curl, CURLOPT_FILE, f );
- if (options != NULL && options->referer != NULL)
- curl_easy_setopt ( curl, CURLOPT_REFERER, options->referer);
- curl_easy_setopt ( curl, CURLOPT_USERAGENT, "viking/" VERSION " libcurl/7.15.4" );
+ curl_easy_setopt ( curl, CURLOPT_WRITEDATA, f );
+ curl_easy_setopt ( curl, CURLOPT_WRITEFUNCTION, curl_write_func);
+ curl_easy_setopt ( curl, CURLOPT_NOPROGRESS, 0 );
+ curl_easy_setopt ( curl, CURLOPT_PROGRESSDATA, NULL );
+ curl_easy_setopt ( curl, CURLOPT_PROGRESSFUNCTION, curl_progress_func);
+ if (options != NULL) {
+ if(options->referer != NULL)
+ curl_easy_setopt ( curl, CURLOPT_REFERER, options->referer);
+ if(options->follow_location != 0) {
+ curl_easy_setopt ( curl, CURLOPT_FOLLOWLOCATION, 1);
+ curl_easy_setopt ( curl, CURLOPT_MAXREDIRS, options->follow_location);
+ }
+ }
+ curl_easy_setopt ( curl, CURLOPT_USERAGENT, curl_download_user_agent );