Buy commercial curl support from WolfSSL. 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
himself.
Re: config file syntax
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Daniel Stenberg via curl-users <curl-users_at_lists.haxx.se>
Date: Sun, 23 Jul 2023 16:36:10 +0200 (CEST)
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
Date: Sun, 23 Jul 2023 16:36:10 +0200 (CEST)
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.htmlReceived on 2023-07-23