From 117b8006d628b03d6e5945338c2362720a7f0e94 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 12 Jan 2023 23:09:24 +0100 Subject: fix #7570 and #7571 --- src/backend/taler-merchant-httpd_exchanges.c | 16 ++++++++++++++++ src/backend/taler-merchant-httpd_private-post-reserves.c | 7 +++++++ 2 files changed, 23 insertions(+) (limited to 'src/backend') diff --git a/src/backend/taler-merchant-httpd_exchanges.c b/src/backend/taler-merchant-httpd_exchanges.c index 7f6336c1..12c75ca4 100644 --- a/src/backend/taler-merchant-httpd_exchanges.c +++ b/src/backend/taler-merchant-httpd_exchanges.c @@ -238,6 +238,12 @@ struct Exchange */ bool trusted; + /** + * true if this exchange did return to use the + * response from /wire. + */ + bool have_wire; + }; @@ -627,6 +633,13 @@ process_find_operations (struct Exchange *exchange) .http_status = MHD_HTTP_OK, }; + if ( (NULL != fo->wire_method) && + (! exchange->have_wire) ) + { + /* We needed /wire, but didn't get it. That's not "200 OK". */ + hr.http_status = MHD_HTTP_BAD_GATEWAY; + hr.ec = TALER_EC_MERCHANT_GENERIC_EXCHANGE_WIRE_REQUEST_FAILED; + } fo->fc (fo->fc_cls, &hr, exchange->conn, @@ -676,6 +689,7 @@ handle_wire_data (void *cls, { struct TMH_EXCHANGES_FindOperation *fo; + exchange->have_wire = false; GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to obtain /wire details from `%s': %u/%d\n", exchange->url, @@ -710,6 +724,7 @@ handle_wire_data (void *cls, }; GNUNET_break_op (0); + exchange->have_wire = false; while (NULL != (fo = exchange->fo_head)) { fo->fc (fo->fc_cls, @@ -722,6 +737,7 @@ handle_wire_data (void *cls, } return; } + exchange->have_wire = true; if ( (process_find_operations (exchange)) && (NULL == exchange->wire_task) && (NULL == exchange->wire_request) ) diff --git a/src/backend/taler-merchant-httpd_private-post-reserves.c b/src/backend/taler-merchant-httpd_private-post-reserves.c index 0351ab10..82fc865f 100644 --- a/src/backend/taler-merchant-httpd_private-post-reserves.c +++ b/src/backend/taler-merchant-httpd_private-post-reserves.c @@ -247,6 +247,13 @@ handle_exchange (void *cls, TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */ return; } + if (MHD_HTTP_OK != hr->http_status) + { + rc->ec = hr->ec; + rc->http_status = hr->http_status; + TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */ + return; + } if (NULL == payto_uri) { rc->ec = TALER_EC_MERCHANT_PRIVATE_POST_RESERVES_UNSUPPORTED_WIRE_METHOD; -- cgit v1.2.3