Re: config file syntax

Daniel Stenberg via curl-users <[email protected]>
Newsgroups gmane.comp.web.curl.general
Message-ID <[email protected]>
On Fri, 21 Jul 2023, jacques granduel via curl-users wrote:

> What would be the syntax for using different headers per url?
>
> Is this snippet the right syntax as I thought?
>
> header = "Accept: application/json"
> url = http://a.com
> header = "Accept: application/xml"
> url = http://b.com
>
> I made a un unsuccessful test, so my config file must be wrong. How is it 
> parsed? Should header be after url??

Every new header (or --header) occurance adds a new header to the request, and 
then all those headers will be used in all requests to the listed URLs.

Until --next, which then resets the parser and you start over on a new header 
set, so you probably want this:

  header = "Accept: to the first URL"
  url = http://first.example
  next
  header = "Accept: to the second URL"
  url = http://second.example

-- 

  / 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-users
Etiquette:   https://curl.se/mail/etiquette.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.