curl / Mailing Lists / curl-users / Single Mail
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: show the URL in the error message?

From: Daniel Stenberg via curl-users <curl-users_at_cool.haxx.se>
Date: Mon, 16 Nov 2020 13:30:03 +0100 (CET)

On Mon, 16 Nov 2020, Alex Bligh wrote:

> Using the URL to disambiguate error messages sounds suboptimal given
> multiple requests could be made to the same URL (e.g. POSTs). How about, if
> there are multiple requests, adding "[Request n]" to the error message?

I thought about that as well but I figured going with the URL could be a first
step as it was easy to add...

Since it is the curl tool adding the URL to the output, it can't really be
"request" but URL, since for example redirect-following is done by libcurl so
curl doesn't know how many requests it did before it failed. And showing
something else than the original input URL in the error text would be
confusing.

To add to the complications, curl can do ranges and sequences like:

  curl 'localhost/[1-7]' localfail

... which thus produces 8 URLs to get and if transfer number 4 fails, it is
the first given URL but it is actually "localhost/4" that failed and not
"localhost/[1-7]". Saying "URL number 4" failed when given two on the command
line might also be hard to explain to users. Or even worse would be if
"localhost/2" would fail, which is the second URL to transfer but the second
URL on the command line is "localfail"...

I need to make sure that curl keeps a mapping from the originally given URL
number to the actually performed transfer to be able to provide this info in
the error message. I'll work on it!

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://www.wolfssl.com/contact/
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2020-11-16