[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] 90/152: implement #6181
From: |
gnunet |
Subject: |
[taler-exchange] 90/152: implement #6181 |
Date: |
Sun, 05 Jul 2020 20:47:26 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
commit c31048b05020420d1bb3a5cdf1c054648f11c214
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri May 1 19:41:14 2020 +0200
implement #6181
---
src/exchange/taler-exchange-httpd.c | 51 +++++++++++++++++++++++++++++++--
src/testing/test_exchange_api_twisted.c | 4 ---
2 files changed, 48 insertions(+), 7 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd.c
b/src/exchange/taler-exchange-httpd.c
index a8e29d30..00932c0f 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -420,6 +420,45 @@ proceed_with_handler (const struct TEH_RequestHandler *rh,
}
+/**
+ * Handle a "/seed" request.
+ *
+ * @param rh context of the handler
+ * @param connection the MHD connection to handle
+ * @param args array of additional options (must be empty for this function)
+ * @return MHD result code
+ */
+static MHD_RESULT
+handler_seed (const struct TEH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ const char *const args[])
+{
+#define SEED_SIZE 32
+ char *body;
+ MHD_RESULT ret;
+ struct MHD_Response *resp;
+
+ (void) rh;
+ body = malloc (SEED_SIZE); /* must use malloc(), because MHD will use free()
*/
+ if (NULL == body)
+ return MHD_NO;
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
+ body,
+ SEED_SIZE);
+ resp = MHD_create_response_from_buffer (SEED_SIZE,
+ body,
+ MHD_RESPMEM_MUST_FREE);
+ TALER_MHD_add_global_headers (resp);
+ ret = MHD_queue_response (connection,
+ MHD_HTTP_OK,
+ resp);
+ GNUNET_break (MHD_YES == ret);
+ MHD_destroy_response (resp);
+ return ret;
+#undef SEED_SIZE
+}
+
+
/**
* Handle incoming HTTP request.
*
@@ -472,6 +511,11 @@ handle_mhd_request (void *cls,
.method = MHD_HTTP_METHOD_GET,
.handler.get = &TEH_handler_agpl_redirect
},
+ {
+ .url = "seed",
+ .method = MHD_HTTP_METHOD_GET,
+ .handler.get = &handler_seed
+ },
/* Terms of service */
{
.url = "terms",
@@ -654,9 +698,10 @@ handle_mhd_request (void *cls,
{
struct TEH_RequestHandler *rh = &handlers[i];
- if (0 != strncmp (tok,
- rh->url,
- tok_size))
+ if ( (0 != strncmp (tok,
+ rh->url,
+ tok_size)) ||
+ (tok_size != strlen (rh->url) ) )
continue;
found = GNUNET_YES;
/* The URL is a match! What we now do depends on the method. */
diff --git a/src/testing/test_exchange_api_twisted.c
b/src/testing/test_exchange_api_twisted.c
index 05337219..c99c7410 100644
--- a/src/testing/test_exchange_api_twisted.c
+++ b/src/testing/test_exchange_api_twisted.c
@@ -205,10 +205,6 @@ run (void *cls,
MHD_HTTP_PRECONDITION_FAILED,
"EUR:50",
"deposit-refund-1"),
- TALER_TESTING_cmd_refund ("refund-fee-too-low",
- MHD_HTTP_BAD_REQUEST,
- "EUR:5",
- "deposit-refund-1"),
TALER_TESTING_cmd_end ()
};
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-exchange] 73/152: testing traits for uint32_t and GNUNET_TIME_Relative, (continued)
- [taler-exchange] 73/152: testing traits for uint32_t and GNUNET_TIME_Relative, gnunet, 2020/07/05
- [taler-exchange] 76/152: Merge branch 'protocolv8' of git+ssh://git.taler.net/exchange into protocolv8, gnunet, 2020/07/05
- [taler-exchange] 79/152: fix FIXME by exposing deposit permission signing in API instead of doing it inside of the testing logic, gnunet, 2020/07/05
- [taler-exchange] 86/152: fix error reporting/handling, gnunet, 2020/07/05
- [taler-exchange] 85/152: move rewind command to exchange, add proper support for rewinding in batches, modify API to rewind to label, gnunet, 2020/07/05
- [taler-exchange] 81/152: response to CB, gnunet, 2020/07/05
- [taler-exchange] 92/152: make tests skip until we have a wallet to regen the DB, gnunet, 2020/07/05
- [taler-exchange] 95/152: modify TALER_EXCHANGE_deposits_get() API to avoid NULL pointers and need for deep copies, gnunet, 2020/07/05
- [taler-exchange] 97/152: return fee as well, gnunet, 2020/07/05
- [taler-exchange] 98/152: towards changing timestamp in deposit confirmation (tests failing), gnunet, 2020/07/05
- [taler-exchange] 90/152: implement #6181,
gnunet <=
- [taler-exchange] 105/152: use unregister, gnunet, 2020/07/05
- [taler-exchange] 91/152: void basedb due to signature format change, gnunet, 2020/07/05
- [taler-exchange] 101/152: implement #6181, gnunet, 2020/07/05
- [taler-exchange] 106/152: more ecs, gnunet, 2020/07/05
- [taler-exchange] 103/152: modify TALER_EXCHANGE_deposits_get() API to avoid NULL pointers and need for deep copies, gnunet, 2020/07/05
- [taler-exchange] 108/152: implement #6181, gnunet, 2020/07/05
- [taler-exchange] 110/152: modify TALER_EXCHANGE_deposits_get() API to combine returned arguments into a struct (simplifies merchant later), gnunet, 2020/07/05
- [taler-exchange] 117/152: fix drop call, gnunet, 2020/07/05
- [taler-exchange] 116/152: update, gnunet, 2020/07/05
- [taler-exchange] 121/152: update ECs, gnunet, 2020/07/05