summaryrefslogtreecommitdiff
path: root/src/libstrongswan/plugins/soup/soup_fetcher.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2014-07-11 07:23:31 +0200
committerYves-Alexis Perez <corsac@debian.org>2014-07-11 07:23:31 +0200
commit81c63b0eed39432878f78727f60a1e7499645199 (patch)
tree82387d8fecd1c20788fd8bd784a9b0bde091fb6b /src/libstrongswan/plugins/soup/soup_fetcher.c
parentc5ebfc7b9c16551fe825dc1d79c3f7e2f096f6c9 (diff)
downloadvyos-strongswan-81c63b0eed39432878f78727f60a1e7499645199.tar.gz
vyos-strongswan-81c63b0eed39432878f78727f60a1e7499645199.zip
Imported Upstream version 5.2.0
Diffstat (limited to 'src/libstrongswan/plugins/soup/soup_fetcher.c')
-rw-r--r--src/libstrongswan/plugins/soup/soup_fetcher.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/libstrongswan/plugins/soup/soup_fetcher.c b/src/libstrongswan/plugins/soup/soup_fetcher.c
index 681a3c357..99525cb79 100644
--- a/src/libstrongswan/plugins/soup/soup_fetcher.c
+++ b/src/libstrongswan/plugins/soup/soup_fetcher.c
@@ -63,6 +63,11 @@ struct private_soup_fetcher_t {
* Fetcher callback function
*/
fetcher_callback_t cb;
+
+ /**
+ * Response status
+ */
+ u_int *result;
};
/**
@@ -119,12 +124,16 @@ METHOD(fetcher_t, fetch, status_t,
DBG2(DBG_LIB, "sending http request to '%s'...", uri);
soup_session_send_message(data.session, message);
+ if (this->result)
+ {
+ *this->result = message->status_code;
+ }
if (SOUP_STATUS_IS_SUCCESSFUL(message->status_code))
{
status = SUCCESS;
}
- else
- {
+ else if (!this->result)
+ { /* only log an error if the code is not returned */
DBG1(DBG_LIB, "HTTP request failed: %s", message->reason_phrase);
}
g_object_unref(G_OBJECT(message));
@@ -157,6 +166,9 @@ METHOD(fetcher_t, set_option, bool,
case FETCH_CALLBACK:
this->cb = va_arg(args, fetcher_callback_t);
break;
+ case FETCH_RESPONSE_CODE:
+ this->result = va_arg(args, u_int*);
+ break;
default:
supported = FALSE;
break;