diff options
Diffstat (limited to 'xs_curl.h')
| -rw-r--r-- | xs_curl.h | 11 |
1 files changed, 11 insertions, 0 deletions
| @@ -9,6 +9,8 @@ xs_dict *xs_http_request(const char *method, const char *url, | |||
| 9 | const xs_str *body, int b_size, int *status, | 9 | const xs_str *body, int b_size, int *status, |
| 10 | xs_str **payload, int *p_size, int timeout); | 10 | xs_str **payload, int *p_size, int timeout); |
| 11 | 11 | ||
| 12 | const char *xs_curl_strerr(int errnum); | ||
| 13 | |||
| 12 | #ifdef XS_IMPLEMENTATION | 14 | #ifdef XS_IMPLEMENTATION |
| 13 | 15 | ||
| 14 | #include <curl/curl.h> | 16 | #include <curl/curl.h> |
| @@ -194,6 +196,15 @@ xs_dict *xs_http_request(const char *method, const char *url, | |||
| 194 | return response; | 196 | return response; |
| 195 | } | 197 | } |
| 196 | 198 | ||
| 199 | |||
| 200 | const char *xs_curl_strerr(int errnum) | ||
| 201 | { | ||
| 202 | CURLcode cc = errnum < 0 ? -errnum : errnum; | ||
| 203 | |||
| 204 | return curl_easy_strerror(cc); | ||
| 205 | } | ||
| 206 | |||
| 207 | |||
| 197 | #endif /* XS_IMPLEMENTATION */ | 208 | #endif /* XS_IMPLEMENTATION */ |
| 198 | 209 | ||
| 199 | #endif /* _XS_CURL_H */ | 210 | #endif /* _XS_CURL_H */ |