curl / Mailing Lists / curl-library / Single Mail


Decoding base64 in parameter parsing

From: Philipp Hagemeister <>
Date: Mon, 3 Sep 2018 02:58:21 +0200

I would like to propose an option --data-as-base64 which allows users to
pass in data containing null bytes, something which is otherwise
impossible without the use of temporary files or pipelines, both of
which are not options for me. See
for more details.

However, it seems I messed up my pull request, as linking crashes with:

/usr/bin/ld: curl-tool_getparam.o: in function `getparameter':
tool_getparam.c:(.text+0x2f2f): undefined reference to `Curl_base64_decode'

I can now reproduce the problem, but I'm not sure how I did manage to
build a working version of curl with my changes (it even passed the
automated and a number of manual tests I did!).

So, how can I use the Curl_base64_decode function in the tool?

1) Copy&pasting code, but that seems wrong.
2) Writing and including a smaller base64 decoder seems like a bad idea
as well.
3) Curl_base64_decode is (rightly) not part of the public libcurl API,
or is it?
4) curlx seems to be made for these cases, but I'm not sure how to
properly configure that. If I just add base64.c to CURLX_CFILES in, the linker is missing Curl_cmalloc . How do I get _that_?
5) I could switch from base64 to another encoding, such as URL-encoding.
Maybe that's simpler to parse. But base64 seems best for binary data
("only" 1/3 overhead).
6) Is there any other option?

Any help would be much appreciated,



Received on 2018-09-03