mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-10 03:50:38 +03:00
Ensure that pd variable stays in scope while curl request runs
Fix for #19
This commit is contained in:
parent
2fd7e20380
commit
4b37678207
@ -93,6 +93,7 @@ d_char *xs_http_request(char *method, char *url, d_char *headers,
|
|||||||
struct curl_slist *list = NULL;
|
struct curl_slist *list = NULL;
|
||||||
char *k, *v, *p;
|
char *k, *v, *p;
|
||||||
long lstatus;
|
long lstatus;
|
||||||
|
struct _payload_data pd;
|
||||||
|
|
||||||
response = xs_dict_new();
|
response = xs_dict_new();
|
||||||
|
|
||||||
@ -128,7 +129,9 @@ d_char *xs_http_request(char *method, char *url, d_char *headers,
|
|||||||
sprintf(tmp, "content-length: %d", b_size);
|
sprintf(tmp, "content-length: %d", b_size);
|
||||||
list = curl_slist_append(list, tmp);
|
list = curl_slist_append(list, tmp);
|
||||||
|
|
||||||
struct _payload_data pd = { body, b_size, 0 };
|
pd.data = body;
|
||||||
|
pd.size = b_size;
|
||||||
|
pd.offset = 0;
|
||||||
|
|
||||||
curl_easy_setopt(curl, CURLOPT_READDATA, &pd);
|
curl_easy_setopt(curl, CURLOPT_READDATA, &pd);
|
||||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, _post_callback);
|
curl_easy_setopt(curl, CURLOPT_READFUNCTION, _post_callback);
|
||||||
|
Loading…
Reference in New Issue
Block a user