summaryrefslogtreecommitdiff
path: root/src/process_url.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/process_url.c')
-rw-r--r--src/process_url.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/process_url.c b/src/process_url.c
index bf2edfd..e51da98 100644
--- a/src/process_url.c
+++ b/src/process_url.c
@@ -39,6 +39,7 @@ mtx_t mtx;
cnd_t cnd;
bool corrupted;
static const char *outdir_g, *referer_g;
+static char *cookie_g;
static callback_t callback_g;
static callback_struct_t *p_callback_struct_g;
static CURLU *h;
@@ -113,6 +114,7 @@ static void curl_easy_setcommonopts(CURL *curl) {
/* enable all supported built-in compressions,
* since serveral sites enable gzip encoding */
curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "");
+ curl_easy_setopt(curl, CURLOPT_COOKIE, cookie_g);
}
static int progress_callback(void *clientp, curl_off_t dltotal,
@@ -440,10 +442,11 @@ static char *callback_struct_convert_fullpath(char *filename) {
return tmp;
}
-void curl_init(curl_conf_t *curl) {
+void curl_init(char *cookie) {
curl_global_init(CURL_GLOBAL_ALL);
h = curl_url();
dl_queue = create_queue();
+ cookie_g = cookie;
mtx_init(&mtx, mtx_plain);
cnd_init(&cnd);
}
@@ -467,6 +470,7 @@ void curl_cleanup(status_t *stat) {
cnd_destroy(&cnd);
}
free_queue(&dl_queue);
+ free_and_nullify(cookie_g);
curl_url_cleanup(h);
curl_global_cleanup();
}