curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support. 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 Daniel himself.

Re: CURLOPT_HTTPHEADER appends headers but does not delete old ones

From: Daniel Stenberg via curl-users <curl-users_at_lists.haxx.se>
Date: Sun, 17 May 2026 00:58:40 +0200 (CEST)

On Fri, 15 May 2026, Mac-Fly via curl-users wrote:

(As this is a libcurl using question, the curl-library is the proper mailing
list to send it to.)

> I have a strange effect that I see in one of my projects where I am setting
> up header entries provided as a list derived from user settings. I am using
> the code below that is supposed to delete old header entries, then collect
> the ones to be applied and finally applies the entries. To my understanding,
> this should only include the headers that I add in this respective call.
> Instead, what happens is that the previous ones remain active and the ones I
> append in further calls to that function are being added additionally. I was
> following the example in: https://curl.se/libcurl/c/CURLOPT_HTTPHEADER.html

That sounds strange.

If you can extend the example code to reproduce the problem we can have a
closer look at it.

-- 
  / daniel.haxx.se || https://rock-solid.curl.dev
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2026-05-17