From 51258871e3ad354ceebc4912548178705b5700d6 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: Mon, 14 Jun 2021 15:24:23 +0800 Subject: Strap results handler --- request.h | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'request.h') diff --git a/request.h b/request.h index dd19400..536db0f 100644 --- a/request.h +++ b/request.h @@ -25,11 +25,11 @@ struct body { extern emscripten_fetch_attr_t attr; #else extern CURL *curl; -extern char *server_url; +extern char *sampleurl; size_t append(char *, size_t, size_t, icclient_fetch_t *); #endif -inline void init(const char *url, const char *certificate) +inline void init(const char *certificate) { #ifdef __EMSCRIPTEN__ emscripten_fetch_attr_init(&attr); @@ -44,12 +44,6 @@ inline void init(const char *url, const char *certificate) #ifdef DEBUG curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); #endif - size_t length = strlen(url); - size_t append = url[length - 1] != '/'; - server_url = malloc(length + append + 1); - strcpy(server_url, url); - if (append) - strcat(server_url, "/"); #endif } @@ -60,7 +54,7 @@ inline void request(void (*handler)(icclient_fetch_t *), void *callback, struct unsigned int ival; size_t length = #ifndef __EMSCRIPTEN__ - strlen(server_url) + + strlen(sampleurl) + #endif strlen(fmt); @@ -90,7 +84,7 @@ inline void request(void (*handler)(icclient_fetch_t *), void *callback, struct #ifdef __EMSCRIPTEN__ memset(url, '\0', length + 1); #else - strcpy(url, server_url); + strcpy(url, sampleurl); #endif va_start(ap, fmt); @@ -158,7 +152,7 @@ inline void request(void (*handler)(icclient_fetch_t *), void *callback, struct #ifndef __EMSCRIPTEN__ inline void cleanup() { - free(server_url); + free(sampleurl); curl_easy_cleanup(curl); curl_global_cleanup(); } -- cgit v1.2.3