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: debug CURLOPT_POSTFIELDS url?

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Mon, 28 Oct 2019 09:53:55 +0100 (CET)

On Mon, 28 Oct 2019, ka sc via curl-library wrote:

> curl -XPOST localhost:4001/db/load -H "Content-type: text/plain"
> --data-binary @"data/input.dump" --libcurl code.c

1. You don't want "-XPOST" when you use -d or a --data* flag. Remove it.

2. "--data-binary @"data/input.dump" is reading the file into a buffer and
uses CURLOPT_POSTFIELDS to send it as a POST.

> curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1);

This would make it use the read callback (or stdin) instead to get the data,
which you of course can opt to do.

-- 
  / daniel.haxx.se | Get the best commercial curl support there is - from me
                   | Private help, bug fixes, support, ports, new features
                   | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2019-10-28