From fdea435076e718b2731aa6ad994cc49ff7e96477 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Tue, 17 Apr 2018 17:00:04 +0200 Subject: Add new function to retrieve HTTP response code Change-Id: I1d01c95d6418646ef9d2f8f4b07210a33b10c117 Signed-off-by: Romain Forlot --- curl-wrap.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'curl-wrap.c') 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; -- cgit 1.2.3-korg