[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-sync] branch master updated: use GNUNET_Buffer to generate URIs
From: |
gnunet |
Subject: |
[taler-sync] branch master updated: use GNUNET_Buffer to generate URIs |
Date: |
Wed, 02 Dec 2020 12:42:40 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository sync.
The following commit(s) were added to refs/heads/master by this push:
new fd86a1a use GNUNET_Buffer to generate URIs
fd86a1a is described below
commit fd86a1a22a2dda6d3f741bf4fef3e220c5129ace
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Dec 2 12:39:44 2020 +0100
use GNUNET_Buffer to generate URIs
This fixes an issue with URLs with double slashes being generated, which
would cause a merchant base URL mismatch error being detected by the
wallet.
(Example:
taler://pay/backend.int.taler.net/instances/Taler//2020.337-01M3QKVDPJEYE/)
Also, the comment about instances is removed, since instances don't need
any special support in sync, they are simply a different payment backend
base URL.
---
src/sync/sync-httpd_backup_post.c | 37 +++++++++++--------------------------
1 file changed, 11 insertions(+), 26 deletions(-)
diff --git a/src/sync/sync-httpd_backup_post.c
b/src/sync/sync-httpd_backup_post.c
index 392675a..a254e30 100644
--- a/src/sync/sync-httpd_backup_post.c
+++ b/src/sync/sync-httpd_backup_post.c
@@ -235,6 +235,7 @@ make_payment_request (const char *order_id,
char *hdr;
char *pfx;
char *hn;
+ struct GNUNET_Buffer hdr_buf = { 0 };
if (0 == strncasecmp ("https://",
SH_backend_url,
@@ -262,35 +263,19 @@ make_payment_request (const char *order_id,
MHD_destroy_response (resp);
return NULL;
}
- // FIXME: support instances?
+
+ GNUNET_buffer_write_str (&hdr_buf, pfx);
+ GNUNET_buffer_write_str (&hdr_buf, "pay/");
+ GNUNET_buffer_write_str (&hdr_buf, hn);
+ GNUNET_buffer_write_path (&hdr_buf, order_id);
+ /* No session ID */
+ GNUNET_buffer_write_path (&hdr_buf, "");
if (NULL != token)
{
- char tok[256];
-
- /* This path should not be taken, as we disabled tokens */
- GNUNET_assert (NULL !=
- GNUNET_STRINGS_data_to_string (token,
- sizeof (*token),
- tok,
- sizeof (tok)));
- GNUNET_asprintf (&hdr,
- "%spay/%s%s%s/?c=%s",
- pfx,
- hn,
- ('/' == hn[strlen (hn) - 1])
- ? ""
- : "/",
- order_id,
- tok);
- }
- else
- {
- GNUNET_asprintf (&hdr,
- "%spay/%s/%s/",
- pfx,
- hn,
- order_id);
+ GNUNET_buffer_write_str (&hdr_buf, "?c=");
+ GNUNET_buffer_write_data_encoded (&hdr_buf, token, sizeof (*token));
}
+ hdr = GNUNET_buffer_reap_str (&hdr_buf);
GNUNET_break (MHD_YES ==
MHD_add_response_header (resp,
"Taler",
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-sync] branch master updated: use GNUNET_Buffer to generate URIs,
gnunet <=