From dbfc626851e75b10b916e9a6b265d28b13034649 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 8 Jan 2020 10:38:44 +0100 Subject: use TALER_MHD_add_global_headers() to set Connection: close and CORS header --- src/sync/sync-httpd_backup.c | 15 +++------------ src/sync/sync-httpd_backup_post.c | 20 ++++---------------- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/src/sync/sync-httpd_backup.c b/src/sync/sync-httpd_backup.c index 0b4f6a0..e3da6b7 100644 --- a/src/sync/sync-httpd_backup.c +++ b/src/sync/sync-httpd_backup.c @@ -81,10 +81,7 @@ SH_backup_get (struct MHD_Connection *connection, resp = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); - GNUNET_break (MHD_YES == - MHD_add_response_header (resp, - MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, - "*")); + TALER_MHD_add_global_headers (resp); ret = MHD_queue_response (connection, MHD_HTTP_NO_CONTENT, resp); @@ -122,10 +119,7 @@ SH_backup_get (struct MHD_Connection *connection, resp = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); - GNUNET_break (MHD_YES == - MHD_add_response_header (resp, - MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, - "*")); + TALER_MHD_add_global_headers (resp); ret = MHD_queue_response (connection, MHD_HTTP_NOT_MODIFIED, resp); @@ -223,10 +217,7 @@ SH_return_backup (struct MHD_Connection *connection, resp = MHD_create_response_from_buffer (backup_size, backup, MHD_RESPMEM_MUST_FREE); - GNUNET_break (MHD_YES == - MHD_add_response_header (resp, - MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, - "*")); + TALER_MHD_add_global_headers (resp); { char *sig_s; char *prev_s; diff --git a/src/sync/sync-httpd_backup_post.c b/src/sync/sync-httpd_backup_post.c index cdec9fd..dc6310b 100644 --- a/src/sync/sync-httpd_backup_post.c +++ b/src/sync/sync-httpd_backup_post.c @@ -221,10 +221,7 @@ make_payment_request (const char *order_id) resp = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); - GNUNET_break (MHD_YES == - MHD_add_response_header (resp, - MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, - "*")); + TALER_MHD_add_global_headers (resp); { char *hdr; @@ -769,10 +766,7 @@ SH_backup_post (struct MHD_Connection *connection, resp = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); - GNUNET_break (MHD_YES == - MHD_add_response_header (resp, - MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, - "*")); + TALER_MHD_add_global_headers (resp); ret = MHD_queue_response (connection, MHD_HTTP_NOT_MODIFIED, resp); @@ -910,10 +904,7 @@ SH_backup_post (struct MHD_Connection *connection, resp = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); - GNUNET_break (MHD_YES == - MHD_add_response_header (resp, - MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, - "*")); + TALER_MHD_add_global_headers (resp); ret = MHD_queue_response (connection, MHD_HTTP_NOT_MODIFIED, resp); @@ -931,10 +922,7 @@ SH_backup_post (struct MHD_Connection *connection, resp = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); - GNUNET_break (MHD_YES == - MHD_add_response_header (resp, - MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, - "*")); + TALER_MHD_add_global_headers (resp); ret = MHD_queue_response (connection, MHD_HTTP_NO_CONTENT, resp); -- cgit v1.2.3