summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_mhd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange/taler-exchange-httpd_mhd.c')
-rw-r--r--src/exchange/taler-exchange-httpd_mhd.c48
1 files changed, 10 insertions, 38 deletions
diff --git a/src/exchange/taler-exchange-httpd_mhd.c b/src/exchange/taler-exchange-httpd_mhd.c
index 95e51c8ed..825a1b310 100644
--- a/src/exchange/taler-exchange-httpd_mhd.c
+++ b/src/exchange/taler-exchange-httpd_mhd.c
@@ -28,6 +28,7 @@
#include <jansson.h>
#include <microhttpd.h>
#include <pthread.h>
+#include "taler_mhd_lib.h"
#include "taler-exchange-httpd_responses.h"
#include "taler-exchange-httpd.h"
#include "taler-exchange-httpd_mhd.h"
@@ -66,7 +67,7 @@ TEH_MHD_handler_static_response (struct TEH_RequestHandler *rh,
GNUNET_break (0);
return MHD_NO;
}
- TEH_RESPONSE_add_global_headers (response);
+ TALER_MHD_add_global_headers (response);
if (NULL != rh->mime_type)
(void) MHD_add_response_header (response,
MHD_HTTP_HEADER_CONTENT_TYPE,
@@ -97,41 +98,12 @@ TEH_MHD_handler_agpl_redirect (struct TEH_RequestHandler *rh,
const char *upload_data,
size_t *upload_data_size)
{
- const char *agpl =
- "This server is licensed under the Affero GPL. You will now be redirected to the source code.";
- struct MHD_Response *response;
- int ret;
-
+ (void) rh;
(void) connection_cls;
(void) upload_data;
(void) upload_data_size;
- response = MHD_create_response_from_buffer (strlen (agpl),
- (void *) agpl,
- MHD_RESPMEM_PERSISTENT);
- if (NULL == response)
- {
- GNUNET_break (0);
- return MHD_NO;
- }
- TEH_RESPONSE_add_global_headers (response);
- if (NULL != rh->mime_type)
- (void) MHD_add_response_header (response,
- MHD_HTTP_HEADER_CONTENT_TYPE,
- rh->mime_type);
- if (MHD_NO ==
- MHD_add_response_header (response,
- MHD_HTTP_HEADER_LOCATION,
- "http://www.git.taler.net/?p=exchange.git"))
- {
- GNUNET_break (0);
- MHD_destroy_response (response);
- return MHD_NO;
- }
- ret = MHD_queue_response (connection,
- rh->response_code,
- response);
- MHD_destroy_response (response);
- return ret;
+ return TALER_MHD_reply_agpl (connection,
+ "http://www.git.taler.net/?p=exchange.git");
}
@@ -156,11 +128,11 @@ TEH_MHD_handler_send_json_pack_error (struct TEH_RequestHandler *rh,
(void) connection_cls;
(void) upload_data;
(void) upload_data_size;
- return TEH_RESPONSE_reply_json_pack (connection,
- rh->response_code,
- "{s:s}",
- "error",
- rh->data);
+ return TALER_MHD_reply_json_pack (connection,
+ rh->response_code,
+ "{s:s}",
+ "error",
+ rh->data);
}