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
signatures?

>     -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.

>     ${PROTOCOL}://$URL${MINIO_PATH}
> 
> 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.
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

Reply via email to