[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: response generation
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: response generation |
Date: |
Thu, 14 Nov 2019 09:54:52 +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 ea5824d response generation
ea5824d is described below
commit ea5824d473349dedeb655cab860462aa5264918d
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Nov 14 09:54:50 2019 +0100
response generation
---
src/backend/anastasis-httpd_policy.c | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/src/backend/anastasis-httpd_policy.c
b/src/backend/anastasis-httpd_policy.c
index 54e5528..28d517f 100644
--- a/src/backend/anastasis-httpd_policy.c
+++ b/src/backend/anastasis-httpd_policy.c
@@ -23,6 +23,7 @@
#include "platform.h"
#include "anastasis-httpd.h"
#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-httpd_responses.h"
/**
* @param connection the MHD connection to handle
@@ -37,6 +38,7 @@ ANASTASIS_MHD_handler_policy_GET (struct MHD_Connection
*connection,
{
struct ANASTASIS_AccountPubP accountPubP;
const char *version_s;
+ int ret;
GNUNET_assert (0 == strncmp (url,
"/policy/",
@@ -50,8 +52,9 @@ ANASTASIS_MHD_handler_policy_GET (struct MHD_Connection
*connection,
strlen (account),
&accountPubP.pub))
{
- // FIXME: nicer error handling, 400 BAD request!
- return MHD_NO;
+ return TMH_RESPONSE_reply_bad_request (connection,
+ 42 /*FIXME */,
+ "account public key malformed");
}
}
version_s = MHD_lookup_connection_value (connection,
@@ -65,8 +68,9 @@ ANASTASIS_MHD_handler_policy_GET (struct MHD_Connection
*connection,
"%u",
&version))
{
- // FIXME: nicer error handling, 400 BAD request!
- return MHD_NO;
+ return TMH_RESPONSE_reply_arg_invalid (connection,
+ 43 /*FIXME */,
+ "version");
}
// call DB variant 1
}
@@ -83,8 +87,26 @@ ANASTASIS_MHD_handler_policy_GET (struct MHD_Connection
*connection,
*/
// BUILD reply
+ // binary reply
+ {
+ struct MHD_Response *response;
+ void *binary = "test";
+ size_t binary_size = 4;
- return MHD_NO;
+ response = MHD_create_response_from_buffer (binary_size,
+ binary,
+ MHD_RESPMEM_MUST_FREE);
+ TMH_RESPONSE_add_global_headers (response);
+ GNUNET_break (MHD_YES ==
+ MHD_add_response_header (response,
+ MHD_HTTP_HEADER_CONTENT_TYPE,
+ "anastasis/encrypted-policy"));
+ ret = MHD_queue_response (connection,
+ MHD_HTTP_OK,
+ response);
+ MHD_destroy_response (response);
+ }
+ return ret;
}
/**
--
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: response generation,
gnunet <=