[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: parse
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: parse |
Date: |
Thu, 14 Nov 2019 09:45:59 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new c9c46b9 parse
c9c46b9 is described below
commit c9c46b9cc51fc448994a0d2d930afbb84946e34d
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Nov 14 09:45:56 2019 +0100
parse
---
src/backend/anastasis-httpd_policy.c | 60 ++++++++++++++++++++++++------------
1 file changed, 41 insertions(+), 19 deletions(-)
diff --git a/src/backend/anastasis-httpd_policy.c
b/src/backend/anastasis-httpd_policy.c
index aca0070..54e5528 100644
--- a/src/backend/anastasis-httpd_policy.c
+++ b/src/backend/anastasis-httpd_policy.c
@@ -26,9 +26,8 @@
/**
* @param connection the MHD connection to handle
- * @param[in,out] connection_cls the connection's closure (can be updated)
- * @param upload_data upload data
- * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
+ * @param url handles a URL of the format
"/policy/$ACCOUNT_PUB[&version=$NUMBER]"
+ * @param con_cls
* @return MHD result code
*/
int
@@ -37,24 +36,45 @@ ANASTASIS_MHD_handler_policy_GET (struct MHD_Connection
*connection,
void **con_cls)
{
struct ANASTASIS_AccountPubP accountPubP;
- // FIXME just for test
- char spliturl [32];
- strcpy (spliturl, url);
- char delimiter[] = "/";
- char *ptr;
- int counter = 0;
- ptr = strtok (spliturl, delimiter);
- while (ptr != NULL)
+ const char *version_s;
+
+ GNUNET_assert (0 == strncmp (url,
+ "/policy/",
+ strlen ("/policy/")));
+ {
+ const char *account;
+
+ account = &url[strlen ("/policy/")];
+ if (GNUNET_OK !=
+ GNUNET_CRYPTO_eddsa_public_key_from_string (account,
+ strlen (account),
+ &accountPubP.pub))
+ {
+ // FIXME: nicer error handling, 400 BAD request!
+ return MHD_NO;
+ }
+ }
+ version_s = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "version");
+ if (NULL != version_s)
{
- if (counter == 1)
+ unsigned int version;
+
+ if (1 != sscanf (version_s,
+ "%u",
+ &version))
{
- size_t encsize = sizeof(&ptr);
- GNUNET_CRYPTO_eddsa_public_key_from_string (ptr,encsize,
- &accountPubP.pub);
+ // FIXME: nicer error handling, 400 BAD request!
+ return MHD_NO;
}
- ptr = strtok (NULL, delimiter);
- counter++;
+ // call DB variant 1
}
+ else
+ {
+ // call DB variant 2
+ }
+
/* db->get_latest_recovery_document (db->cls,
&accountPubP,
&recoverydatasize,
@@ -62,7 +82,9 @@ ANASTASIS_MHD_handler_policy_GET (struct MHD_Connection
*connection,
&res_version));
*/
- return GNUNET_OK;
+ // BUILD reply
+
+ return MHD_NO;
}
/**
@@ -81,5 +103,5 @@ ANASTASIS_MHD_handler_policy_POST (struct MHD_Connection
*connection,
{
- return GNUNET_OK;
+ return MHD_NO;
}
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: parse,
gnunet <=