-misc minor fixes

This commit is contained in:
Christian Grothoff 2023-07-05 13:13:16 +02:00
parent 999db0fb80
commit 1db17d43bd
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 28 additions and 3 deletions

View File

@ -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,

View File

@ -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:

View File

@ -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 = {