Manas
Manas

Reputation: 94

How to set the value of CURLOPT_HTTPHEADER in a C program so as to not sent the HTTP Header in the HTTP Post request?

I am sending a post request in http but I don't want to send the HTTP header, and I came to know that by setting some value for CURLOPT_HTTPHEADER in a C program we can avoid sending the HTTP header. I want to know how I can do this.

Upvotes: 0

Views: 607

Answers (2)

Carlo Wood
Carlo Wood

Reputation: 6821

To remove an internal default header, set the header with no value right of the colon. Ie, if "Content-Type" is a default header and you want it to not be sent, you would "add" the header "Content-Type:" to the headers that you set with CURLOPT_HTTPHEADER.

Upvotes: 1

Mahmoud Al-Qudsi
Mahmoud Al-Qudsi

Reputation: 29579

Your question is very confusing. You want to send an HTTP request without sending any HTTP headers at all? That's not possible - the headers are PART of the definition of the HTTP request.

In fact, you can send a blank HTTP request with no content but w/ the correct HTTP headers and that would be a valid HTTP request. But you simply can't send an HTTP request that has no headers (at all) but has a body, because without them, it's not an HTTP request.

Perhaps you just need to send a TCP message.

Upvotes: 0

Related Questions