summaryrefslogtreecommitdiff
path: root/src/wire-plugins
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-06-12 19:16:43 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2018-06-12 19:16:43 +0200
commit6f579eb833be396b56903ff7252c3023ef46a92d (patch)
tree449e83b49c02c88d72d91396c3dfb186412d511c /src/wire-plugins
parent01f933bbdc69388eb6e0c7a476292a9b667d9027 (diff)
downloadexchange-6f579eb833be396b56903ff7252c3023ef46a92d.tar.gz
exchange-6f579eb833be396b56903ff7252c3023ef46a92d.tar.bz2
exchange-6f579eb833be396b56903ff7252c3023ef46a92d.zip
From payto:// to base url.
The conversion prepends http// or https:// depending on the port given beside the hostname. If port is 433, then prepends https://, otherwise prepends http://. For now, the conversion was only necessary at the /history bank lib.
Diffstat (limited to 'src/wire-plugins')
-rw-r--r--src/wire-plugins/plugin_wire_taler-bank.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/wire-plugins/plugin_wire_taler-bank.c b/src/wire-plugins/plugin_wire_taler-bank.c
index 4d2d9be0f..0954fd882 100644
--- a/src/wire-plugins/plugin_wire_taler-bank.c
+++ b/src/wire-plugins/plugin_wire_taler-bank.c
@@ -978,6 +978,9 @@ taler_bank_get_history (void *cls,
const uint64_t *start_off_b64;
uint64_t start_row;
struct Account account;
+ char *bank_base_url;
+ char *p;
+ long long unsigned port;
if (0 == num_results)
{
@@ -1029,8 +1032,40 @@ taler_bank_get_history (void *cls,
whh->hres_cb = hres_cb;
whh->hres_cb_cls = hres_cb_cls;
+
+ if (NULL != (p = strchr (account.hostname,
+ (unsigned char) ':')))
+ {
+ p++;
+ if (1 != sscanf (p,
+ "%llu",
+ &port))
+ {
+ GNUNET_break (0);
+ TALER_LOG_ERROR ("Malformed host from payto:// URI\n");
+ return NULL;
+ }
+ }
+
+ if (443 != port)
+ {
+ GNUNET_assert
+ (GNUNET_SYSERR != GNUNET_asprintf
+ (&bank_base_url,
+ "http://%s",
+ account.hostname));
+ }
+ else
+ {
+ GNUNET_assert
+ (GNUNET_SYSERR != GNUNET_asprintf
+ (&bank_base_url,
+ "https://%s",
+ account.hostname));
+ }
+
whh->hh = TALER_BANK_history (tc->ctx,
- account.hostname,
+ bank_base_url,
&whh->auth,
(uint64_t) account.no,
direction,