From: Bastian Dehn Date: Sun, 21 Jan 2024 15:50:20 +0000 (+0100) Subject: use url builder for request X-Git-Tag: v1.0.0^2~487 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=49a358f9932b421abfe515fb31e872852c19710b;p=sane-kds-s2000w-net.git use url builder for request --- diff --git a/src/kds_s2000w_handler.c b/src/kds_s2000w_handler.c index 145762d..55b89f1 100644 --- a/src/kds_s2000w_handler.c +++ b/src/kds_s2000w_handler.c @@ -52,7 +52,11 @@ device_state kds_s2000w_handler_open() return NOTCONNECTED; response resp = {0}; - curl_easy_setopt(curl, CURLOPT_URL, "http://scanner.lan.hhaalo.de/api/session"); + CURLU* url_handler = curl_url(); + curl_url_set(url_handler, CURLUPART_URL, "http://scanner.lan.hhaalo.de/api/session", 0); + char* url = NULL; + curl_url_get(url_handler, CURLUPART_URL, &url, 0); + curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_POST, 1L); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"OCPUserName\":\"hhaalo\"}"); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback); @@ -81,6 +85,10 @@ device_state kds_s2000w_handler_open() resObj = NULL; curl_easy_cleanup(curl); curl = NULL; + curl_url_cleanup(url_handler); + url_handler = NULL; + curl_free(url); + url = NULL; return returnState; }