aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChloe Kudryavtsev <code@toast.bunkerlabs.net>2023-03-20 22:04:22 -0400
committerChloe Kudryavtsev <code@toast.bunkerlabs.net>2023-03-20 22:04:22 -0400
commit7335fbe3500b110e1e057a1f1c72b56299069dd4 (patch)
tree97a2aa589569eccc12f2f57ac6c839d65d493eae
parentnative: add header_callback support (diff)
native: perform now *just* performs
The low level in-janet client is underway now. As such I no longer need native code to do option heavy lifting.
-rw-r--r--jurl.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/jurl.c b/jurl.c
index 365740a..0795497 100644
--- a/jurl.c
+++ b/jurl.c
@@ -107,22 +107,6 @@ size_t write_buffer_callback(void *contents, size_t size, size_t nmemb, void* us
JANET_CFUN(jurl_perform) {
janet_fixarity(argc, 1);
jurl_handle *jurl = (jurl_handle*)janet_getabstract(argv, 0, &jurl_type);
-
- // receiving data slots
- JanetBuffer *buf = janet_buffer(0);
- JanetTable *out = janet_table(3);
-
- curl_easy_setopt(jurl->handle, CURLOPT_WRITEFUNCTION, write_buffer_callback);
- curl_easy_setopt(jurl->handle, CURLOPT_WRITEDATA, (void*)buf);
CURLcode res = curl_easy_perform(jurl->handle);
-
- // get results back
- janet_table_put(out, janet_ckeywordv("curlcode"), janet_wrap_integer(res));
- janet_table_put(out, janet_ckeywordv("body"), janet_wrap_buffer(buf));
-
- // also the status
- long codep = 0;
- if (res == CURLE_OK) res = curl_easy_getinfo(jurl->handle, CURLINFO_RESPONSE_CODE, &codep);
- janet_table_put(out, janet_ckeywordv("status"), janet_wrap_integer(codep));
- return janet_wrap_struct(janet_table_to_struct(out));
+ return janet_wrap_boolean(res == CURLE_OK);
}