fix #6967
This commit is contained in:
parent
d821db366a
commit
c0d4a35a51
@ -139,6 +139,12 @@ static json_t *out;
|
|||||||
*/
|
*/
|
||||||
static char *currency;
|
static char *currency;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL of the exchange we are interacting with
|
||||||
|
* as per our configuration.
|
||||||
|
*/
|
||||||
|
static char *CFG_exchange_url;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A subcommand supported by this program.
|
* A subcommand supported by this program.
|
||||||
@ -1789,11 +1795,12 @@ do_upload (char *const *args)
|
|||||||
global_ret = EXIT_FAILURE;
|
global_ret = EXIT_FAILURE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (GNUNET_OK !=
|
if ( (NULL == CFG_exchange_url) &&
|
||||||
GNUNET_CONFIGURATION_get_value_string (kcfg,
|
(GNUNET_OK !=
|
||||||
"exchange",
|
GNUNET_CONFIGURATION_get_value_string (kcfg,
|
||||||
"BASE_URL",
|
"exchange",
|
||||||
&exchange_url))
|
"BASE_URL",
|
||||||
|
&CFG_exchange_url)) )
|
||||||
{
|
{
|
||||||
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"exchange",
|
"exchange",
|
||||||
@ -1802,10 +1809,9 @@ do_upload (char *const *args)
|
|||||||
test_shutdown ();
|
test_shutdown ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trigger_upload (exchange_url);
|
trigger_upload (CFG_exchange_url);
|
||||||
json_decref (out);
|
json_decref (out);
|
||||||
out = NULL;
|
out = NULL;
|
||||||
GNUNET_free (exchange_url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2264,11 +2270,17 @@ download_cb (void *cls,
|
|||||||
case MHD_HTTP_OK:
|
case MHD_HTTP_OK:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
if (0 != hr->http_status)
|
||||||
"Failed to download keys: %s (HTTP status: %u/%u)\n",
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
hr->hint,
|
"Failed to download keys from `%s': %s (HTTP status: %u/%u)\n",
|
||||||
hr->http_status,
|
CFG_exchange_url,
|
||||||
(unsigned int) hr->ec);
|
hr->hint,
|
||||||
|
hr->http_status,
|
||||||
|
(unsigned int) hr->ec);
|
||||||
|
else
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
|
"Failed to download keys from `%s' (no HTTP response)\n",
|
||||||
|
CFG_exchange_url);
|
||||||
test_shutdown ();
|
test_shutdown ();
|
||||||
global_ret = EXIT_FAILURE;
|
global_ret = EXIT_FAILURE;
|
||||||
return;
|
return;
|
||||||
@ -2298,13 +2310,12 @@ download_cb (void *cls,
|
|||||||
static void
|
static void
|
||||||
do_download (char *const *args)
|
do_download (char *const *args)
|
||||||
{
|
{
|
||||||
char *exchange_url;
|
if ( (NULL == CFG_exchange_url) &&
|
||||||
|
(GNUNET_OK !=
|
||||||
if (GNUNET_OK !=
|
GNUNET_CONFIGURATION_get_value_string (kcfg,
|
||||||
GNUNET_CONFIGURATION_get_value_string (kcfg,
|
"exchange",
|
||||||
"exchange",
|
"BASE_URL",
|
||||||
"BASE_URL",
|
&CFG_exchange_url)) )
|
||||||
&exchange_url))
|
|
||||||
{
|
{
|
||||||
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"exchange",
|
"exchange",
|
||||||
@ -2314,10 +2325,9 @@ do_download (char *const *args)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mgkh = TALER_EXCHANGE_get_management_keys (ctx,
|
mgkh = TALER_EXCHANGE_get_management_keys (ctx,
|
||||||
exchange_url,
|
CFG_exchange_url,
|
||||||
&download_cb,
|
&download_cb,
|
||||||
(void *) args);
|
(void *) args);
|
||||||
GNUNET_free (exchange_url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -298,8 +298,16 @@ handle_get_keys_finished (void *cls,
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* unexpected response code */
|
/* unexpected response code */
|
||||||
hr.ec = TALER_JSON_get_error_code (json);
|
if (NULL != json)
|
||||||
hr.hint = TALER_JSON_get_error_hint (json);
|
{
|
||||||
|
hr.ec = TALER_JSON_get_error_code (json);
|
||||||
|
hr.hint = TALER_JSON_get_error_hint (json);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
|
||||||
|
hr.hint = TALER_ErrorCode_get_hint (hr.ec);
|
||||||
|
}
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Unexpected response code %u/%d for exchange management get keys\n",
|
"Unexpected response code %u/%d for exchange management get keys\n",
|
||||||
(unsigned int) response_code,
|
(unsigned int) response_code,
|
||||||
|
Loading…
Reference in New Issue
Block a user