cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Adding empty HTTP Headers to curl requests?

From: Rathi, Dinesh <drathi_at_informatica.com>
Date: Fri, 27 Jan 2006 10:18:27 +0530

I needed something similar for myself. I tried hack of appending two
header values in one header i.e. "Non_Empty_Header:
NE\r\nEmpty_Header:". If this is sent as it is to the HTTP server then
due to a \r\n in between it gets split into two headers and empty header
is sent. Not sure if it breaks anything but it worked for me.

Thanks
Dinesh

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Daniel Stenberg
Sent: Thursday, January 26, 2006 5:02 PM
To: libcurl development
Subject: Re: Adding empty HTTP Headers to curl requests?

On Thu, 26 Jan 2006, Cyrill Osterwalder wrote:

> I'm wondering if libcurl supports adding empty HTTP headers to
requests? An
> empty HTTP header means a header that does not have a value after the
colon,
> e.g. ("EmptyHeader:").

No it doesn't! ;-(

> Empty HTTP headers are imho legal according to RFC. They are used in
certain
> environments to indicate special things to back-end services.

Yes, I agree that it was a bad choice back then to prevent blank
headers...
but hey, what's done is done!

> Any suggestions how empty HTTP headers could/should be supported by
libcurl?

Not really, but I'm thinking we could for example exploit the fact that
headers aren't allowed to contain ascii 1 - 31, not in the name nor in
the
"field-body" part. Thus we could easily for example let "header:\x01"
mean
"add this header with a blank data". We could even hide the kludgy
feeling by
using a define instead of \x01, like: "header:" NO_FIELD_BODY or
similar.

Opinions? Other ideas?

-- 
  Commercial curl and libcurl Technical Support:
http://haxx.se/curl.html
Received on 2006-01-27