curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: help - libcurl frozen when retrieve token from microsoft cognitive api

From: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Mon, 21 Aug 2023 13:38:02 +0200 (CEST)

On Mon, 21 Aug 2023, Hua-Tong Shi via curl-library wrote:

> curl_easy_setopt(curl_ptr, CURLOPT_POST, 1L);

You ask libcurl to do a POST, but without telling it *what* to post. Like
CURLOPT_POSTFIELDS set to "" (a zero length string) since you seem to not want
to actually send any data in the POST.

Without knowing what to post and with no callback set, it reads from stdin by
default.

> headers_ptr = curl_slist_append(headers_ptr, "Content-Length: 0");

Then you also won't have to artificially add this header since libcurl will
do that by itself.

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://curl.se/support.html
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-08-21