add support for saving and loading cookies

This commit is contained in:
ading2210 2024-03-19 18:41:54 -04:00
parent d23703ff9a
commit f8e55ea307
7 changed files with 65 additions and 12 deletions

View file

@ -1,5 +1,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "cjson/cJSON.h"
#include "curl/curl.h"
@ -65,6 +66,11 @@ void http_set_options(CURL* http_handle, const char* json_params, const char* bo
request_info->headers_list = headers_list;
}
void http_set_cookie_jar(CURL* http_handle, const char* filename) {
curl_easy_setopt(http_handle, CURLOPT_COOKIEFILE, filename);
curl_easy_setopt(http_handle, CURLOPT_COOKIEJAR, filename);
}
char* http_get_info(CURL* http_handle) {
struct RequestInfo *request_info = get_request_info(http_handle);