20

I want to add an empty header in my HTTP packet. Something like:

Someheader:

But I see that libcurl does not support that. They propose a workaround by concatenating the empty header with another header:

"Someheader:\r\nheader1: value"

Does the latest libcurl offer another — more proper — way to send an empty header?

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
MOHAMED
  • 41,599
  • 58
  • 163
  • 268

1 Answers1

30

Per an example on the libcurl site, you can replace the colon with a semicolon. That will expand into an empty header. So:

Someheader;

will actually be sent as:

Someheader: 
Paul Roub
  • 36,322
  • 27
  • 84
  • 93
  • as I saw still not same like regular requests. in normally requests if empty still have one space before value but with that there is no space after : Someheader:here need to be a space – MyMeMo May 22 '23 at 22:26