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:10:32 +0200

Hi Daniel,

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

> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se
> [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of
> Daniel Stenberg
> Sent: Wednesday, August 13, 2008 10:55 AM
> To: libcurl development
> Subject: Re: Double accept-header upon easy handle reuse
>
> On Tue, 12 Aug 2008, Gabriel Kälin wrote:
>
> > 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
>
> --
>
> / daniel.haxx.se
>
Received on 2008-08-13