cURL / Mailing Lists / curl-library / Single Mail


RE: Adding empty HTTP Headers to curl requests?

From: Rathi, Dinesh <>
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.


-----Original Message-----
[] 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
> e.g. ("EmptyHeader:").

No it doesn't! ;-(

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

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

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

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
"field-body" part. Thus we could easily for example let "header:\x01"
"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

Opinions? Other ideas?

  Commercial curl and libcurl Technical Support:
Received on 2006-01-27