summaryrefslogtreecommitdiff
path: root/include/curl/urlapi.h
diff options
context:
space:
mode:
authori-ky <gl.ivanovsky@gmail.com>2021-09-27 08:22:54 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-09-27 08:28:46 +0200
commit3363eeb26298b9d30fc5ec29101e5dd205d04db9 (patch)
tree5546b8dc873a7e918d651485ed735dbce6f69d62 /include/curl/urlapi.h
parentf0b8d1c5f646506d5c1fbf73edfbed900aa016e4 (diff)
downloadcurl-3363eeb26298b9d30fc5ec29101e5dd205d04db9.tar.gz
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
Diffstat (limited to 'include/curl/urlapi.h')
-rw-r--r--include/curl/urlapi.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/curl/urlapi.h b/include/curl/urlapi.h
index 1d7088011..3c4b4e18a 100644
--- a/include/curl/urlapi.h
+++ b/include/curl/urlapi.h
@@ -47,7 +47,8 @@ typedef enum {
CURLUE_NO_HOST, /* 14 */
CURLUE_NO_PORT, /* 15 */
CURLUE_NO_QUERY, /* 16 */
- CURLUE_NO_FRAGMENT /* 17 */
+ CURLUE_NO_FRAGMENT, /* 17 */
+ CURLUE_LAST
} CURLUcode;
typedef enum {
@@ -118,6 +119,12 @@ CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what,
CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what,
const char *part, unsigned int flags);
+/*
+ * curl_url_strerror() turns a CURLUcode value into the equivalent human
+ * readable error string. This is useful for printing meaningful error
+ * messages.
+ */
+CURL_EXTERN const char *curl_url_strerror(CURLUcode);
#ifdef __cplusplus
} /* end of extern "C" */