curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder Daniel himself.

HTTP headers

From: Ali Nasir via curl-library <curl-library_at_lists.haxx.se>
Date: Wed, 12 Jun 2024 13:50:32 +0530

Hi,
I have a question about the HTTP headers. The use case is a file
transfer using multipart form data. We have a custom header to send. For
example Shoe-Size: 10.
When we set this header using:
   list = curl_slist_append(list, "Shoesize: 10");
   curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
then i notice that the libcurl does not set the Content-Type and
Content-Length: headers.

If i do like this: curl_easy_setopt(curl, CURLOPT_HTTPHEADER, NULL); then
the libcurl sets the content-Type and content-length headers.

How do i let libcurl set my custom header and also set the content header
without explicitly setting the content headers?

If we set some custom header, why does libcurl remove the content headers?

Thanks in advance
Ali


-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2024-06-12