]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
set post size open session
authorBastian Dehn <hhaalo@arcor.de>
Thu, 16 Oct 2025 16:24:25 +0000 (18:24 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Thu, 16 Oct 2025 16:24:25 +0000 (18:24 +0200)
src/kds_s2000w_client.c

index 8e72cc438cbb048fd1f6e7ea75795211e72ca751..6d5283364eda7a94ffbc9c2995a7f96541c75b38 100644 (file)
@@ -244,7 +244,6 @@ void kds_s2000w_client_init(const client_config_t* config)
        client_config->username = _kds_s2000w_client_strdup(config->username);
        client_config->ssl_verify = config->ssl_verify;
        client_config->heartbeat = config->heartbeat;
-
        curl_global_init(CURL_GLOBAL_ALL);
 }
 
@@ -300,16 +299,15 @@ uint8_t kds_s2000w_client_open_session(response* resp)
        curl_url_set(param->url_handler, CURLUPART_PATH, SESSION_PATH, 0);
        curl_url_get(param->url_handler, CURLUPART_URL, &param->url, 0);
        curl_easy_setopt(param->curl, CURLOPT_URL, param->url);
-
        char* body = _kds_s2000w_client_get_username_body();
        if (body == NULL) {
                _kds_s2000w_client_param_free(param);
                param = NULL;
                return CURLE_OUT_OF_MEMORY;
        }
-
        curl_easy_setopt(param->curl, CURLOPT_POST, 1L);
        curl_easy_setopt(param->curl, CURLOPT_POSTFIELDS, body);
+       curl_easy_setopt(param->curl, CURLOPT_POSTFIELDSIZE, (uint64_t) strlen(body));
        curl_easy_setopt(param->curl, CURLOPT_WRITEDATA, resp);
        CURLcode result = curl_easy_perform(param->curl);
        _kds_s2000w_client_add_null_terminate_to_response(resp);
@@ -338,7 +336,6 @@ void kds_s2000w_client_close_session(int64_t sessionid)
        curl_url_set(param->url_handler, CURLUPART_PATH, SESSION_PATH, 0);
        curl_url_get(param->url_handler, CURLUPART_URL, &param->url, 0);
        curl_easy_setopt(param->curl, CURLOPT_URL, param->url);
-
        curl_easy_setopt(param->curl, CURLOPT_CUSTOMREQUEST, HTTP_DELETE);
        CURLcode result = curl_easy_perform(param->curl);