aboutsummaryrefslogtreecommitdiff
path: root/src/mint/taler-mint-httpd_wire.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mint/taler-mint-httpd_wire.c')
-rw-r--r--src/mint/taler-mint-httpd_wire.c31
1 files changed, 4 insertions, 27 deletions
diff --git a/src/mint/taler-mint-httpd_wire.c b/src/mint/taler-mint-httpd_wire.c
index 1eb3f6bef..020a7e108 100644
--- a/src/mint/taler-mint-httpd_wire.c
+++ b/src/mint/taler-mint-httpd_wire.c
@@ -21,6 +21,7 @@
#include "platform.h"
#include "taler-mint-httpd_keystate.h"
#include "taler-mint-httpd_responses.h"
+#include "taler-mint-httpd_validation.h"
#include "taler-mint-httpd_wire.h"
#include <jansson.h>
@@ -45,24 +46,10 @@ TMH_WIRE_handler_wire (struct TMH_RequestHandler *rh,
struct TALER_MintPublicKeyP pub;
struct TALER_MintSignatureP sig;
json_t *methods;
- struct GNUNET_HashContext *hc;
- unsigned int i;
- const char *wf;
- methods = json_array ();
- hc = GNUNET_CRYPTO_hash_context_start ();
- for (i=0;NULL != (wf = TMH_expected_wire_formats[i]); i++)
- {
- json_array_append_new (methods,
- json_string (wf));
- GNUNET_CRYPTO_hash_context_read (hc,
- wf,
- strlen (wf) + 1);
- }
wsm.purpose.size = htonl (sizeof (wsm));
wsm.purpose.purpose = htonl (TALER_SIGNATURE_MINT_WIRE_TYPES);
- GNUNET_CRYPTO_hash_context_finish (hc,
- &wsm.h_wire_types);
+ methods = TMH_VALIDATION_get_methods (&wsm.h_wire_types);
TMH_KS_sign (&wsm.purpose,
&pub,
&sig);
@@ -97,7 +84,6 @@ TMH_WIRE_handler_wire_test (struct TMH_RequestHandler *rh,
struct MHD_Response *response;
int ret;
char *wire_test_redirect;
- unsigned int i;
response = MHD_create_response_from_buffer (0, NULL,
MHD_RESPMEM_PERSISTENT);
@@ -107,11 +93,7 @@ TMH_WIRE_handler_wire_test (struct TMH_RequestHandler *rh,
return MHD_NO;
}
TMH_RESPONSE_add_global_headers (response);
- for (i=0;NULL != TMH_expected_wire_formats[i];i++)
- if (0 == strcasecmp ("test",
- TMH_expected_wire_formats[i]))
- break;
- if (NULL == TMH_expected_wire_formats[i])
+ if (GNUNET_NO == TMH_VALIDATION_test_method ("test"))
{
/* Return 501: not implemented */
ret = MHD_queue_response (connection,
@@ -165,13 +147,8 @@ TMH_WIRE_handler_wire_sepa (struct TMH_RequestHandler *rh,
char *sepa_wire_file;
int fd;
struct stat sbuf;
- unsigned int i;
- for (i=0;NULL != TMH_expected_wire_formats[i];i++)
- if (0 == strcasecmp ("sepa",
- TMH_expected_wire_formats[i]))
- break;
- if (NULL == TMH_expected_wire_formats[i])
+ if (GNUNET_NO == TMH_VALIDATION_test_method ("sepa"))
{
/* Return 501: not implemented */
response = MHD_create_response_from_buffer (0, NULL,