diff options
Diffstat (limited to 'src/backend/anastasis-httpd.c')
-rw-r--r-- | src/backend/anastasis-httpd.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c index e2b363c..4ef6087 100644 --- a/src/backend/anastasis-httpd.c +++ b/src/backend/anastasis-httpd.c | |||
@@ -361,12 +361,15 @@ url_handler (void *cls, | |||
361 | strlen ("/policy/"))) | 361 | strlen ("/policy/"))) |
362 | { | 362 | { |
363 | const char *account = url + strlen ("/policy/"); | 363 | const char *account = url + strlen ("/policy/"); |
364 | const char *end = strchr (account, '/'); | ||
364 | struct ANASTASIS_CRYPTO_AccountPublicKeyP account_pub; | 365 | struct ANASTASIS_CRYPTO_AccountPublicKeyP account_pub; |
365 | 366 | ||
366 | if (GNUNET_OK != | 367 | if (GNUNET_OK != |
367 | GNUNET_STRINGS_string_to_data ( | 368 | GNUNET_STRINGS_string_to_data ( |
368 | account, | 369 | account, |
369 | strlen (account), | 370 | (NULL == end) |
371 | ? strlen (account) | ||
372 | : end - account, | ||
370 | &account_pub, | 373 | &account_pub, |
371 | sizeof (struct ANASTASIS_CRYPTO_AccountPublicKeyP))) | 374 | sizeof (struct ANASTASIS_CRYPTO_AccountPublicKeyP))) |
372 | { | 375 | { |
@@ -375,14 +378,23 @@ url_handler (void *cls, | |||
375 | TALER_EC_GENERIC_PARAMETER_MALFORMED, | 378 | TALER_EC_GENERIC_PARAMETER_MALFORMED, |
376 | "account public key"); | 379 | "account public key"); |
377 | } | 380 | } |
381 | if ( (NULL != end) && | ||
382 | (0 != strcmp (end, | ||
383 | "/meta")) ) | ||
384 | return TMH_MHD_handler_static_response (&h404, | ||
385 | connection); | ||
378 | if (0 == strcmp (method, | 386 | if (0 == strcmp (method, |
379 | MHD_HTTP_METHOD_GET)) | 387 | MHD_HTTP_METHOD_GET)) |
380 | { | 388 | { |
381 | return AH_policy_get (connection, | 389 | if (NULL == end) |
382 | &account_pub); | 390 | return AH_policy_get (connection, |
391 | &account_pub); | ||
392 | return AH_policy_meta_get (connection, | ||
393 | &account_pub); | ||
383 | } | 394 | } |
384 | if (0 == strcmp (method, | 395 | if ( (0 == strcmp (method, |
385 | MHD_HTTP_METHOD_POST)) | 396 | MHD_HTTP_METHOD_POST)) && |
397 | (NULL == end) ) | ||
386 | { | 398 | { |
387 | return AH_handler_policy_post (connection, | 399 | return AH_handler_policy_post (connection, |
388 | hc, | 400 | hc, |