diff options
-rw-r--r-- | src/exchange/taler-exchange-httpd_keys.c | 8 | ||||
-rw-r--r-- | src/lib/exchange_api_handle.c | 21 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_run_fakebank.c | 2 |
3 files changed, 28 insertions, 3 deletions
diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c index e53f27327..8b9e54b46 100644 --- a/src/exchange/taler-exchange-httpd_keys.c +++ b/src/exchange/taler-exchange-httpd_keys.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2020-2022 Taler Systems SA + Copyright (C) 2020-2023 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software @@ -1701,8 +1701,10 @@ setup_general_response_headers (struct TEH_KeyStateHandle *ksh, TALER_MHD_get_date_string (m.abs_time, dat); GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Setting /keys 'Expires' header to '%s'\n", - dat); + "Setting /keys 'Expires' header to '%s' (rekey frequency is %s)\n", + dat, + GNUNET_TIME_relative2s (ksh->rekey_frequency, + false)); GNUNET_break (MHD_YES == MHD_add_response_header (response, MHD_HTTP_HEADER_EXPIRES, diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c index 0ea7e642b..40ae390fb 100644 --- a/src/lib/exchange_api_handle.c +++ b/src/lib/exchange_api_handle.c @@ -69,6 +69,13 @@ */ #define DEFAULT_EXPIRATION GNUNET_TIME_UNIT_HOURS +/** + * If the "Expire" cache control header is missing, for + * how long do we assume the reply to be valid at least? + */ +#define MINIMUM_EXPIRATION GNUNET_TIME_relative_multiply ( \ + GNUNET_TIME_UNIT_MINUTES, 2) + /** * Handle for a GET /keys request. @@ -1109,6 +1116,20 @@ keys_completed_cb (void *cls, break; } kd->rc = 1; + kd->key_data_expiration = gkh->expire; + if (GNUNET_TIME_relative_cmp ( + GNUNET_TIME_absolute_get_remaining (gkh->expire.abs_time), + <, + MINIMUM_EXPIRATION)) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Exchange returned keys with expiration time below %s. Compensating.\n", + GNUNET_TIME_relative2s (MINIMUM_EXPIRATION, + true)); + kd->key_data_expiration + = GNUNET_TIME_relative_to_timestamp (MINIMUM_EXPIRATION); + } + kresp.details.ok.keys = kd; break; case MHD_HTTP_BAD_REQUEST: diff --git a/src/testing/testing_api_cmd_run_fakebank.c b/src/testing/testing_api_cmd_run_fakebank.c index f9a6b9b69..03b36763c 100644 --- a/src/testing/testing_api_cmd_run_fakebank.c +++ b/src/testing/testing_api_cmd_run_fakebank.c @@ -110,6 +110,7 @@ run_fakebank_cleanup (void *cls, } GNUNET_free (rfs->ba.wire_gateway_url); GNUNET_free (rfs->bank_url); + GNUNET_free (rfs->currency); GNUNET_free (rfs); } @@ -195,6 +196,7 @@ TALER_TESTING_cmd_run_fakebank ( exchange_xtalerbank_account); GNUNET_free (exchange_xtalerbank_account); } + GNUNET_free (exchange_payto_uri); rfs->ba.method = TALER_BANK_AUTH_NONE; { struct TALER_TESTING_Command cmd = { |