urlapi: add curl_url_strerror()

Add curl_url_strerror() to convert CURLUcode into readable string and
facilitate easier troubleshooting in programs using URL API.
Extend CURLUcode with CURLU_LAST for iteration in unit tests.
Update man pages with a mention of new function.
Update example code and tests with new functionality where it fits.

Closes #7605
This commit is contained in:
i-ky 2021-09-27 08:22:54 +02:00 committed by Daniel Stenberg
parent f0b8d1c5f6
commit 3363eeb262
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
25 changed files with 233 additions and 72 deletions

View file

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -26,8 +26,8 @@
#include <stdio.h>
#include <curl/curl.h>
#if !CURL_AT_LEAST_VERSION(7, 62, 0)
#error "this example requires curl 7.62.0 or later"
#if !CURL_AT_LEAST_VERSION(7, 80, 0)
#error "this example requires curl 7.80.0 or later"
#endif
int main(void)
@ -47,7 +47,7 @@ int main(void)
"http://example.com/path/index.html", 0);
if(uc) {
fprintf(stderr, "curl_url_set() failed: %in", uc);
fprintf(stderr, "curl_url_set() failed: %s", curl_url_strerror(uc));
goto cleanup;
}