summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c39
1 files changed, 9 insertions, 30 deletions
diff --git a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
index 3953fa06..5b5f6b05 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
@@ -26,6 +26,7 @@
#include <taler/taler_json_lib.h>
#include "taler-merchant-httpd_private-post-orders-ID-refund.h"
#include "taler-merchant-httpd_private-get-orders.h"
+#include "taler-merchant-httpd_helper.h"
/**
@@ -82,43 +83,21 @@ make_taler_refund_uri (struct MHD_Connection *connection,
const char *instance_id,
const char *order_id)
{
- const char *host;
- const char *forwarded_host;
- const char *uri_path;
- struct GNUNET_Buffer buf = { 0 };
+ struct GNUNET_Buffer buf;
GNUNET_assert (NULL != instance_id);
GNUNET_assert (NULL != order_id);
- host = MHD_lookup_connection_value (connection,
- MHD_HEADER_KIND,
- "Host");
- forwarded_host = MHD_lookup_connection_value (connection,
- MHD_HEADER_KIND,
- "X-Forwarded-Host");
- uri_path = MHD_lookup_connection_value (connection,
- MHD_HEADER_KIND,
- "X-Forwarded-Prefix");
- if (NULL != forwarded_host)
- host = forwarded_host;
- if (NULL == host)
+ if (GNUNET_OK !=
+ TMH_taler_uri_by_connection (connection,
+ "refund",
+ instance_id,
+ &buf))
{
- /* Should never happen, at least the host header should be defined */
GNUNET_break (0);
return NULL;
}
- GNUNET_buffer_write_str (&buf, "taler");
- if (GNUNET_NO == TALER_mhd_is_https (connection))
- GNUNET_buffer_write_str (&buf, "+http");
- GNUNET_buffer_write_str (&buf, "://refund/");
- GNUNET_buffer_write_str (&buf, host);
- if (NULL != uri_path)
- GNUNET_buffer_write_path (&buf, uri_path);
- if (0 != strcmp ("default", instance_id))
- {
- GNUNET_buffer_write_path (&buf, "instances");
- GNUNET_buffer_write_path (&buf, instance_id);
- }
- GNUNET_buffer_write_path (&buf, order_id);
+ GNUNET_buffer_write_path (&buf,
+ order_id);
GNUNET_buffer_write_path (&buf,
""); /* Trailing slash */
return GNUNET_buffer_reap_str (&buf);