diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-05-03 15:46:00 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-05-03 15:46:00 +0200 |
commit | 634fc3090574ca303d0fe30ad3189c889782d2cb (patch) | |
tree | 3ffff8b21f2acc6647ec0e6aa94a0977caa5d59c /src/backend/taler-merchant-httpd_get-tips-ID.c | |
parent | fbba13c83b7e209962558c9207358f607074a6da (diff) | |
download | merchant-634fc3090574ca303d0fe30ad3189c889782d2cb.tar.gz merchant-634fc3090574ca303d0fe30ad3189c889782d2cb.tar.bz2 merchant-634fc3090574ca303d0fe30ad3189c889782d2cb.zip |
expand merchant order logic to return exchanges trusted by the merchant and indicate priority based on exchange /wire respons availability and restrictions
Diffstat (limited to 'src/backend/taler-merchant-httpd_get-tips-ID.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_get-tips-ID.c | 97 |
1 files changed, 15 insertions, 82 deletions
diff --git a/src/backend/taler-merchant-httpd_get-tips-ID.c b/src/backend/taler-merchant-httpd_get-tips-ID.c index f9e6c8cd..71c66d51 100644 --- a/src/backend/taler-merchant-httpd_get-tips-ID.c +++ b/src/backend/taler-merchant-httpd_get-tips-ID.c @@ -25,6 +25,7 @@ #include <taler/taler_json_lib.h> #include <taler/taler_templating_lib.h> #include "taler-merchant-httpd_get-tips-ID.h" +#include "taler-merchant-httpd_helper.h" #include "taler-merchant-httpd_mhd.h" #include "taler-merchant-httpd_qr.h" @@ -34,52 +35,18 @@ TMH_make_taler_tip_uri (struct MHD_Connection *con, const struct TALER_TipIdentifierP *tip_id, const char *instance_id) { - const char *host; - const char *forwarded_host; - const char *uri_path; struct GNUNET_Buffer buf = { 0 }; - host = MHD_lookup_connection_value (con, - MHD_HEADER_KIND, - "Host"); - forwarded_host = MHD_lookup_connection_value (con, - MHD_HEADER_KIND, - "X-Forwarded-Host"); - - uri_path = MHD_lookup_connection_value (con, - MHD_HEADER_KIND, - "X-Forwarded-Prefix"); - if (NULL != forwarded_host) - host = forwarded_host; - - if (NULL == host) - { - GNUNET_break (0); - return NULL; - } - GNUNET_assert (NULL != instance_id); GNUNET_assert (NULL != tip_id); - - GNUNET_buffer_write_str (&buf, - "taler"); - if (GNUNET_NO == TALER_mhd_is_https (con)) - GNUNET_buffer_write_str (&buf, - "+http"); - GNUNET_buffer_write_str (&buf, - "://tip/"); - GNUNET_buffer_write_str (&buf, - host); - if (NULL != uri_path) - GNUNET_buffer_write_path (&buf, - uri_path); - if (0 != strcmp ("default", - instance_id)) + if (GNUNET_OK != + TMH_taler_uri_by_connection (con, + "tip", + instance_id, + &buf)) { - GNUNET_buffer_write_path (&buf, - "instances"); - GNUNET_buffer_write_path (&buf, - instance_id); + GNUNET_break (0); + return NULL; } /* Ensure previous part is slash-terminated */ GNUNET_buffer_write_path (&buf, @@ -96,51 +63,17 @@ TMH_make_tip_status_url (struct MHD_Connection *con, const struct TALER_TipIdentifierP *tip_id, const char *instance_id) { - const char *host; - const char *forwarded_host; - const char *uri_path; - struct GNUNET_Buffer buf = { 0 }; - - host = MHD_lookup_connection_value (con, - MHD_HEADER_KIND, - "Host"); - forwarded_host = MHD_lookup_connection_value (con, - MHD_HEADER_KIND, - "X-Forwarded-Host"); - - uri_path = MHD_lookup_connection_value (con, - MHD_HEADER_KIND, - "X-Forwarded-Prefix"); - if (NULL != forwarded_host) - host = forwarded_host; - - if (NULL == host) - { - GNUNET_break (0); - return NULL; - } + struct GNUNET_Buffer buf; GNUNET_assert (NULL != instance_id); GNUNET_assert (NULL != tip_id); - - if (GNUNET_NO == TALER_mhd_is_https (con)) - GNUNET_buffer_write_str (&buf, - "http://"); - else - GNUNET_buffer_write_str (&buf, - "https://"); - GNUNET_buffer_write_str (&buf, - host); - if (NULL != uri_path) - GNUNET_buffer_write_path (&buf, - uri_path); - if (0 != strcmp ("default", - instance_id)) + if (GNUNET_OK != + TMH_base_url_by_connection (con, + instance_id, + &buf)) { - GNUNET_buffer_write_path (&buf, - "instances"); - GNUNET_buffer_write_path (&buf, - instance_id); + GNUNET_break (0); + return NULL; } GNUNET_buffer_write_path (&buf, "tips/"); |