diff options
Diffstat (limited to 'src/backend/anastasis-httpd.c')
-rw-r--r-- | src/backend/anastasis-httpd.c | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c index 0c9d957..4428851 100644 --- a/src/backend/anastasis-httpd.c +++ b/src/backend/anastasis-httpd.c @@ -439,17 +439,19 @@ url_handler (void *cls, TALER_EC_GENERIC_PARAMETER_MALFORMED, "truth UUID"); } - if ( (NULL == end) && - (0 == strcmp (method, - MHD_HTTP_METHOD_GET)) ) - { - return AH_handler_truth_get (connection, - &tu, - hc); - } - if ( (NULL == end) && - (0 == strcmp (method, - MHD_HTTP_METHOD_POST)) ) + if ( (NULL != end) && + (0 != strcmp (end, "/solve")) && + (0 != strcmp (end, "/challenge")) ) + return TMH_MHD_handler_static_response (&h404, + connection); + if (0 == strcmp (method, + MHD_HTTP_METHOD_OPTIONS)) + return TALER_MHD_reply_cors_preflight (connection); + if (0 != strcmp (method, + MHD_HTTP_METHOD_POST)) + return TMH_MHD_handler_static_response (&h405, + connection); + if (NULL == end) { return AH_handler_truth_post (connection, hc, @@ -457,11 +459,8 @@ url_handler (void *cls, upload_data, upload_data_size); } - if ( (NULL != end) && - (0 == strcmp (end, - "/solve")) && - (0 == strcmp (method, - MHD_HTTP_METHOD_POST)) ) + if (0 == strcmp (end, + "/solve")) { return AH_handler_truth_solve (connection, hc, @@ -469,11 +468,8 @@ url_handler (void *cls, upload_data, upload_data_size); } - if ( (NULL != end) && - (0 == strcmp (end, - "/challenge")) && - (0 == strcmp (method, - MHD_HTTP_METHOD_POST)) ) + if (0 == strcmp (end, + "/challenge")) { return AH_handler_truth_challenge (connection, hc, @@ -481,14 +477,9 @@ url_handler (void *cls, upload_data, upload_data_size); } - if (0 == strcmp (method, - MHD_HTTP_METHOD_OPTIONS)) - { - return TALER_MHD_reply_cors_preflight (connection); - } - return TMH_MHD_handler_static_response (&h405, - connection); - } + /* should be impossible to get here */ + GNUNET_assert (0); + } /* end of "/truth/" prefix */ path_matched = false; for (unsigned int i = 0; NULL != handlers[i].url; i++) { @@ -531,7 +522,6 @@ do_shutdown (void *cls) { (void) cls; AH_resume_all_bc (); - AH_truth_shutdown (); AH_truth_challenge_shutdown (); AH_truth_solve_shutdown (); AH_truth_upload_shutdown (); @@ -1030,7 +1020,6 @@ main (int argc, "CERTTYPE", "type of the TLS client certificate, defaults to PEM if not specified", &certtype), - GNUNET_GETOPT_OPTION_END }; |