summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-08-09 15:54:36 +0200
committerGravatar default2023-08-09 15:54:36 +0200
commit912cfb5aaa915829efe92cc34ad7ad888e93c14a (patch)
tree350744e7907f318c8dac42dc72cc9940a2f9ed74
parentRevert "Implemented hide_followers_only." (diff)
downloadsnac2-912cfb5aaa915829efe92cc34ad7ad888e93c14a.tar.gz
snac2-912cfb5aaa915829efe92cc34ad7ad888e93c14a.tar.xz
snac2-912cfb5aaa915829efe92cc34ad7ad888e93c14a.zip
Backport from xs.
-rw-r--r--xs_curl.h10
-rw-r--r--xs_json.h5
-rw-r--r--xs_version.h2
3 files changed, 10 insertions, 7 deletions
diff --git a/xs_curl.h b/xs_curl.h
index dbc1325..9f9b63b 100644
--- a/xs_curl.h
+++ b/xs_curl.h
@@ -96,7 +96,7 @@ xs_dict *xs_http_request(const char *method, const char *url,
96 xs_dict *p; 96 xs_dict *p;
97 xs_str *k; 97 xs_str *k;
98 xs_val *v; 98 xs_val *v;
99 long lstatus; 99 long lstatus = 0;
100 struct _payload_data pd; 100 struct _payload_data pd;
101 101
102 response = xs_dict_new(); 102 response = xs_dict_new();
@@ -160,7 +160,7 @@ xs_dict *xs_http_request(const char *method, const char *url,
160 curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list); 160 curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
161 161
162 /* do it */ 162 /* do it */
163 curl_easy_perform(curl); 163 CURLcode cc = curl_easy_perform(curl);
164 164
165 curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &lstatus); 165 curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &lstatus);
166 166
@@ -168,8 +168,12 @@ xs_dict *xs_http_request(const char *method, const char *url,
168 168
169 curl_slist_free_all(list); 169 curl_slist_free_all(list);
170 170
171 if (status != NULL) 171 if (status != NULL) {
172 if (lstatus == 0)
173 lstatus = -cc;
174
172 *status = (int) lstatus; 175 *status = (int) lstatus;
176 }
173 177
174 if (p_size != NULL) 178 if (p_size != NULL)
175 *p_size = ipd.size; 179 *p_size = ipd.size;
diff --git a/xs_json.h b/xs_json.h
index b8b6b3a..368e5d6 100644
--- a/xs_json.h
+++ b/xs_json.h
@@ -189,8 +189,7 @@ typedef enum {
189 JS_COLON, 189 JS_COLON,
190 JS_VALUE, 190 JS_VALUE,
191 JS_STRING, 191 JS_STRING,
192 JS_INTEGER, 192 JS_NUMBER,
193 JS_REAL,
194 JS_TRUE, 193 JS_TRUE,
195 JS_FALSE, 194 JS_FALSE,
196 JS_NULL, 195 JS_NULL,
@@ -287,7 +286,7 @@ static xs_val *_xs_json_load_lexer(FILE *f, js_type *t)
287 286
288 ungetc(c, f); 287 ungetc(c, f);
289 if (fscanf(f, "%lf", &d) == 1) { 288 if (fscanf(f, "%lf", &d) == 1) {
290 *t = JS_REAL; 289 *t = JS_NUMBER;
291 v = xs_number_new(d); 290 v = xs_number_new(d);
292 } 291 }
293 } 292 }
diff --git a/xs_version.h b/xs_version.h
index 5131181..7da6c06 100644
--- a/xs_version.h
+++ b/xs_version.h
@@ -1 +1 @@
/* 4d883b5331e9275f2439b0983a0f978d1cd21e11 */ /* ac9fa6f1941aa3e701bbb1da50b4d5a07090eddb */