summaryrefslogtreecommitdiff
path: root/xs_curl.h
diff options
context:
space:
mode:
authorGravatar default2023-02-02 03:49:38 +0100
committerGravatar default2023-02-02 03:49:38 +0100
commit463439283a3f346a8869df6d17a70f20a0a02419 (patch)
tree8c9ec3c9c2552a8dab6ee55bceca9f5951ae8788 /xs_curl.h
parentBackport from xs. (diff)
downloadsnac2-463439283a3f346a8869df6d17a70f20a0a02419.tar.gz
snac2-463439283a3f346a8869df6d17a70f20a0a02419.tar.xz
snac2-463439283a3f346a8869df6d17a70f20a0a02419.zip
Minor header tweaks.
Diffstat (limited to 'xs_curl.h')
-rw-r--r--xs_curl.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/xs_curl.h b/xs_curl.h
index 2637c02..1ac0e13 100644
--- a/xs_curl.h
+++ b/xs_curl.h
@@ -4,8 +4,9 @@
4 4
5#define _XS_CURL_H 5#define _XS_CURL_H
6 6
7xs_dict *xs_http_request(char *method, char *url, xs_dict *headers, 7xs_dict *xs_http_request(const char *method, const char *url,
8 xs_str *body, int b_size, int *status, 8 const xs_dict *headers,
9 const xs_str *body, int b_size, int *status,
9 xs_str **payload, int *p_size, int timeout); 10 xs_str **payload, int *p_size, int timeout);
10 11
11#ifdef XS_IMPLEMENTATION 12#ifdef XS_IMPLEMENTATION
@@ -83,8 +84,9 @@ static int _post_callback(char *buffer, size_t size,
83} 84}
84 85
85 86
86xs_dict *xs_http_request(char *method, char *url, xs_dict *headers, 87xs_dict *xs_http_request(const char *method, const char *url,
87 xs_str *body, int b_size, int *status, 88 const xs_dict *headers,
89 const xs_str *body, int b_size, int *status,
88 xs_str **payload, int *p_size, int timeout) 90 xs_str **payload, int *p_size, int timeout)
89/* does an HTTP request */ 91/* does an HTTP request */
90{ 92{
@@ -136,7 +138,7 @@ xs_dict *xs_http_request(char *method, char *url, xs_dict *headers,
136 sprintf(tmp, "content-length: %d", b_size); 138 sprintf(tmp, "content-length: %d", b_size);
137 list = curl_slist_append(list, tmp); 139 list = curl_slist_append(list, tmp);
138 140
139 pd.data = body; 141 pd.data = (char *)body;
140 pd.size = b_size; 142 pd.size = b_size;
141 pd.offset = 0; 143 pd.offset = 0;
142 144
@@ -146,7 +148,7 @@ xs_dict *xs_http_request(char *method, char *url, xs_dict *headers,
146 } 148 }
147 149
148 /* fill the request headers */ 150 /* fill the request headers */
149 p = headers; 151 p = (xs_dict *)headers;
150 while (xs_dict_iter(&p, &k, &v)) { 152 while (xs_dict_iter(&p, &k, &v)) {
151 xs *h = xs_fmt("%s: %s", k, v); 153 xs *h = xs_fmt("%s: %s", k, v);
152 154