summaryrefslogtreecommitdiff
path: root/request.h
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-06-18 02:25:02 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-06-18 02:25:02 +0800
commit1df77942aee0dbd6e79e5aa019d2bcb95c59e6ec (patch)
treed2c97d2fbd89c2a8999425899c984d7c43702323 /request.h
parentd8844d9038e99e2d6175c4a2d99f36bde28deae9 (diff)
Leave request as the minimum of what needs to be shared
Diffstat (limited to 'request.h')
-rw-r--r--request.h30
1 files changed, 1 insertions, 29 deletions
diff --git a/request.h b/request.h
index a946afb..561891a 100644
--- a/request.h
+++ b/request.h
@@ -29,24 +29,6 @@ extern char *sampleurl;
size_t append(char *, size_t, size_t, icclient_response *);
#endif
-static inline void init(const char *certificate)
-{
-#ifdef __EMSCRIPTEN__
- emscripten_fetch_attr_init(&attr);
- attr.attributes = EMSCRIPTEN_FETCH_LOAD_TO_MEMORY;
-#else
- curl_global_init(CURL_GLOBAL_SSL);
- curl = curl_easy_init();
- curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
- curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
- if (certificate)
- curl_easy_setopt(curl, CURLOPT_CAINFO, certificate);
-#ifdef DEBUG
- curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
-#endif
-#endif
-}
-
static inline void request(void (*handler)(icclient_response *), void (*callback)(void *), struct body *body, char *fmt, ...)
{
va_list ap;
@@ -109,10 +91,9 @@ static inline void request(void (*handler)(icclient_response *), void (*callback
#ifdef __EMSCRIPTEN__
if (handler)
attr.onsuccess = handler;
- char *post = NULL;
if (body) {
size_t length = 0;
- post = malloc(1);
+ char *post = malloc(1);
memset(post, '\0', 1);
for (size_t i = 0; i < body->num_pairs; i++) {
struct pair pair = body->pairs[i];
@@ -173,13 +154,4 @@ static inline void request(void (*handler)(icclient_response *), void (*callback
#endif
}
-#ifndef __EMSCRIPTEN__
-static inline void cleanup()
-{
- free(sampleurl);
- curl_easy_cleanup(curl);
- curl_global_cleanup();
-}
-#endif
-
#endif