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: libcurl and s3/minio

From: Dan Fandrich via curl-library <>
Date: Tue, 26 Mar 2024 11:01:24 -0700

On Tue, Mar 26, 2024 at 11:36:07AM -0600, R C via curl-library wrote:
> I am trying to find out how to write something, using libcurl, to do some io
> with a minio object store (s3 compatible)
> I did go a bit through the examples page (some I have used as een example for
> other projects), but could really find what I was looking for. I did find a
> script that uses curl (the command) that seems to work
> this is a code fragment, for what I try to write into C.

Do you know about the --libcurl option? It can write your code for you.

> curl --insecure \

--insecure is a bad idea, especially when you're sending credentials over the
wire. You should fix your certificate store so that it's not needed.

>     -o "${OUT_FILE}" \
>     -H "Host: $URL" \

This is seldom needed because curl adds it on its own.

>     -H "Date: ${DATE}" \

Date: on a request? I've never seen that before. Is that needed by AWS

>     -H "Content-Type: ${CONTENT_TYPE}" \

This one doesn't make much sense on a GET request, because there is no content
being sent. Did you really want Accept:?

>     -H "Authorization: AWS ${USERNAME}:${SIGNATURE}" \

curl versions since 7.75.0 have AWS signature calculation built-in, with the
--aws-sigv4 option.

> I saw an example called httpcustomheader, which came closest to what I'm
> looking for I think.

This is a very simple request with one custom header, so simple.c will do fine
with the addition of CURLOPT_HTTPHEADER which you can see how to do in many
other examples. But look at the curl's built-in AWS support first.
Received on 2024-03-26