From 1df77942aee0dbd6e79e5aa019d2bcb95c59e6ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Fri, 18 Jun 2021 02:25:02 +0800 Subject: Leave request as the minimum of what needs to be shared --- request.h | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'request.h') 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 -- cgit v1.2.3