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.

Re: HTTP headers

From: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Wed, 12 Jun 2024 10:26:14 +0200 (CEST)

On Wed, 12 Jun 2024, Ali Nasir via curl-library wrote:

> 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.

This does not match the intended, tested or documented behavior.

Easily verified with this:

   curl -H "Shoesize: 10" -d moo -v localhost

... sends both Content-Length and Content-Type correctly.

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

If you can give us a small stand-alone example reproducing this, maybe we can
figure out what's going on!

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://curl.se/support.html
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2024-06-12