summaryrefslogtreecommitdiff
path: root/src/restclient
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-01-19 13:29:47 +0100
committerChristian Grothoff <christian@grothoff.org>2022-01-19 13:29:47 +0100
commitb973491c643a5e86e3df3acb9fc62a62d9401438 (patch)
treeee582ffe52f403cc450a0cb7d2f87bc4c1ecdcea /src/restclient
parent16bb30ce4b424fa5ada004c53721a6f3f202b538 (diff)
downloadanastasis-b973491c643a5e86e3df3acb9fc62a62d9401438.tar.gz
anastasis-b973491c643a5e86e3df3acb9fc62a62d9401438.tar.bz2
anastasis-b973491c643a5e86e3df3acb9fc62a62d9401438.zip
enable meta-data upload in REST client logic
Diffstat (limited to 'src/restclient')
-rw-r--r--src/restclient/anastasis_api_policy_store.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/restclient/anastasis_api_policy_store.c b/src/restclient/anastasis_api_policy_store.c
index b709472..2432079 100644
--- a/src/restclient/anastasis_api_policy_store.c
+++ b/src/restclient/anastasis_api_policy_store.c
@@ -1,6 +1,6 @@
/*
This file is part of ANASTASIS
- Copyright (C) 2014-2021 Anastasis SARL
+ Copyright (C) 2014-2022 Anastasis SARL
ANASTASIS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -356,6 +356,8 @@ ANASTASIS_policy_store (
const struct ANASTASIS_CRYPTO_AccountPrivateKeyP *anastasis_priv,
const void *recovery_data,
size_t recovery_data_size,
+ const void *recovery_meta_data,
+ size_t recovery_meta_data_size,
uint32_t payment_years_requested,
const struct ANASTASIS_PaymentSecretP *payment_secret,
struct GNUNET_TIME_Relative payment_timeout,
@@ -425,6 +427,31 @@ ANASTASIS_policy_store (
}
job_headers = ext;
+ /* Setup meta-data header */
+ if (NULL != recovery_meta_data)
+ {
+ char *meta_val;
+
+ meta_val = GNUNET_STRINGS_data_to_string_alloc (
+ recovery_meta_data,
+ recovery_meta_data_size);
+ GNUNET_asprintf (&hdr,
+ "%s: %s",
+ ANASTASIS_HTTP_HEADER_POLICY_META_DATA,
+ meta_val);
+ GNUNET_free (meta_val);
+ ext = curl_slist_append (job_headers,
+ hdr);
+ GNUNET_free (hdr);
+ if (NULL == ext)
+ {
+ GNUNET_break (0);
+ curl_slist_free_all (job_headers);
+ return NULL;
+ }
+ job_headers = ext;
+ }
+
/* Setup Payment-Identifier header */
if (NULL != payment_secret)
{