summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-01-17 00:27:04 +0100
committerChristian Grothoff <christian@grothoff.org>2020-01-17 00:27:04 +0100
commitab70e0410c5dea3b6cf9b57c7290fa1a791b846f (patch)
tree8c7eda8d8cb63d82e75c907e0fc588c994b93a40
parent76bfa4bf4087e19ac00ff258fda902daf08a7b46 (diff)
downloadmerchant-ab70e0410c5dea3b6cf9b57c7290fa1a791b846f.tar.gz
merchant-ab70e0410c5dea3b6cf9b57c7290fa1a791b846f.tar.bz2
merchant-ab70e0410c5dea3b6cf9b57c7290fa1a791b846f.zip
fix FTBFS and #6030
-rw-r--r--src/backend/taler-merchant-httpd.c13
-rw-r--r--src/backend/taler-merchant-httpd_order.c20
2 files changed, 22 insertions, 11 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index 395cff04..6073aed5 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -1433,7 +1433,13 @@ url_handler (void *cls,
if ( (0 != strcasecmp (effective_url, rh->url)) )
continue;
url_found = GNUNET_YES;
- if ( (rh->method != NULL) && (0 != strcasecmp (method, rh->method)) )
+ if (0 == strcasecmp (method,
+ MHD_HTTP_METHOD_OPTIONS))
+ {
+ return TALER_MHD_reply_cors_preflight (connection);
+ }
+ if ( (rh->method != NULL) &&
+ (0 != strcasecmp (method, rh->method)) )
continue;
selected_handler = rh;
break;
@@ -1449,6 +1455,11 @@ url_handler (void *cls,
if ( (0 != strcasecmp (effective_url, rh->url)) )
continue;
url_found = GNUNET_YES;
+ if (0 == strcasecmp (method,
+ MHD_HTTP_METHOD_OPTIONS))
+ {
+ return TALER_MHD_reply_cors_preflight (connection);
+ }
if ( (rh->method != NULL) && (0 != strcasecmp (method, rh->method)) )
continue;
selected_handler = rh;
diff --git a/src/backend/taler-merchant-httpd_order.c b/src/backend/taler-merchant-httpd_order.c
index 892dfce7..a862178e 100644
--- a/src/backend/taler-merchant-httpd_order.c
+++ b/src/backend/taler-merchant-httpd_order.c
@@ -150,12 +150,12 @@ make_merchant_base_url (struct MHD_Connection *connection, const
const char *host;
const char *forwarded_host;
const char *uri_path;
- struct TALER_Buffer buf = { 0 };
+ struct GNUNET_Buffer buf = { 0 };
if (GNUNET_YES == TALER_mhd_is_https (connection))
- TALER_buffer_write_str (&buf, "https://");
+ GNUNET_buffer_write_str (&buf, "https://");
else
- TALER_buffer_write_str (&buf, "http://");
+ GNUNET_buffer_write_str (&buf, "http://");
host = MHD_lookup_connection_value (connection, MHD_HEADER_KIND, "Host");
@@ -164,12 +164,12 @@ make_merchant_base_url (struct MHD_Connection *connection, const
if (NULL != forwarded_host)
{
- TALER_buffer_write_str (&buf, forwarded_host);
+ GNUNET_buffer_write_str (&buf, forwarded_host);
}
else
{
GNUNET_assert (NULL != host);
- TALER_buffer_write_str (&buf, host);
+ GNUNET_buffer_write_str (&buf, host);
}
uri_path = MHD_lookup_connection_value (connection, MHD_HEADER_KIND,
@@ -181,16 +181,16 @@ make_merchant_base_url (struct MHD_Connection *connection, const
GNUNET_assert (0);
}
- TALER_buffer_write_path (&buf, "public");
+ GNUNET_buffer_write_path (&buf, "public");
if (0 != strcmp (instance_id, "default"))
{
- TALER_buffer_write_path (&buf, "/instances/");
- TALER_buffer_write_str (&buf, instance_id);
+ GNUNET_buffer_write_path (&buf, "/instances/");
+ GNUNET_buffer_write_str (&buf, instance_id);
}
- TALER_buffer_write_path (&buf, "");
+ GNUNET_buffer_write_path (&buf, "");
- return TALER_buffer_reap_str (&buf);
+ return GNUNET_buffer_reap_str (&buf);
}