diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-04-17 17:00:04 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-12-13 14:12:02 +0100 |
commit | 40a5f980d11b9f54ecd595c692e814a9655d6221 (patch) | |
tree | c379acbc2ea99a10e91d794c35abca9f02418a35 /curl-wrap.c | |
parent | 16377de92c254202ab62d4118f94014ced06af14 (diff) |
Add new function to retrieve HTTP response code
Change-Id: I1d01c95d6418646ef9d2f8f4b07210a33b10c117
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'curl-wrap.c')
-rw-r--r-- | curl-wrap.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/curl-wrap.c b/curl-wrap.c index d2aacaf..851eeb7 100644 --- a/curl-wrap.c +++ b/curl-wrap.c @@ -171,6 +171,15 @@ int curl_wrap_content_type_is(CURL *curl, const char *value) return !strncasecmp(actual, value, strcspn(actual, "; ")); } +long curl_wrap_response_code_get(CURL *curl) +{ + long rc; + CURLcode code; + + code = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &rc); + return (code == CURLE_OK) ? rc : 0; +} + CURL *curl_wrap_prepare_get_url(const char *url) { CURL *curl; |