cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Double accept-header upon easy handle reuse

From: Gabriel Kälin <Gabriel.Kaelin_at_visonys.com>
Date: Wed, 13 Aug 2008 12:14:31 +0200

Hi Daniel,

Sorry for top-posting just a minute ago. Here the same, but "correctly" posted reply:

> > When you create an easy handle, but don't set the Accept header yourself,
> > libcurl adds an implicit Accept header. Now the problem arises, if for a
> > subsequent request on the easy handle you try to set your custom Accept
> > header, because the request will end with two Accept headers: Yours and the
> > implicit one! Some servers don't like two accept headers at all, while it is
> > confusing at best.
>
> You didn't tell what libcurl version you're using, but I wrote up an example
> that tried to mimic your description and it works just fine for me with my
> current dev version. The code I used is now available here:
>
> http://curl.haxx.se/lxr/source/docs/examples/httpcustomheader.c

thanks for the test. Yes, I forgot to mention that I used libcurl 7.18.0. I've just now compiled libcurl 7.18.2 and replayed your test. The second request looks then like:

GET / HTTP/1.1
Host: server
Accept: */*
Accept: moo

...still including two Accept headers. So with libcurl 7.18.2 I can still observe the unwanted behavior.

Gabriel
Received on 2008-08-13