curl-library
Re: How to set/change single custom header?
Date: Fri, 12 Apr 2019 17:13:38 +0200 (CEST)
On Thu, 11 Apr 2019, Grant Edwards via curl-library wrote:
> Next, I'd like to change the value of _one_ of the custom headers each time
> the request is perfomred. I can't figure out how to do that.
>
> It appears there's no way to add/set a single custom header without clearing
> all of the previously set custom headers. Is that correct?
Yes, and no.
If you stick to using the simple provided functions to build the list then
that's the only option, yes.
But you'll notice that 'struct curl_slist' is a very simply and public struct,
so when use curl_slist_append() it just builds a linked list out of such
structs. You can easily make your own functions to do the same and you can, if
you want to, just fine the single header in that list that you want to update
and update that specific node in the list between each new libcurl invocation.
Or another take would be to create a whole set of lists to begin with and then
just change between those pre-made lists while you do your requests.
It's just code. The number of options is infinite! =)
-- / daniel.haxx.se ------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.htmlReceived on 2019-04-12