[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: use more of libtalermhd
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: use more of libtalermhd |
Date: |
Sun, 24 Nov 2019 17:57:16 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new 61fb789 use more of libtalermhd
61fb789 is described below
commit 61fb789bddc52ebae1043ab0362c91d158758fe1
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Nov 24 17:57:13 2019 +0100
use more of libtalermhd
---
src/backend/anastasis-httpd.h | 1 +
src/backend/anastasis-httpd_mhd.c | 98 ++++++---------------------------------
src/backend/anastasis-httpd_mhd.h | 42 -----------------
3 files changed, 16 insertions(+), 125 deletions(-)
diff --git a/src/backend/anastasis-httpd.h b/src/backend/anastasis-httpd.h
index 73ddf27..0a00c76 100644
--- a/src/backend/anastasis-httpd.h
+++ b/src/backend/anastasis-httpd.h
@@ -23,6 +23,7 @@
#include "platform.h"
#include <microhttpd.h>
+#include <taler/taler_mhd_lib.h>
#include "anastasis_database_lib.h"
/**
diff --git a/src/backend/anastasis-httpd_mhd.c
b/src/backend/anastasis-httpd_mhd.c
index d14bd3a..2faf58b 100644
--- a/src/backend/anastasis-httpd_mhd.c
+++ b/src/backend/anastasis-httpd_mhd.c
@@ -25,7 +25,6 @@
#include "platform.h"
#include <jansson.h>
#include "anastasis-httpd_mhd.h"
-#include "anastasis-httpd_responses.h"
/**
@@ -46,29 +45,16 @@ TMH_MHD_handler_static_response (struct TMH_RequestHandler
*rh,
const char *upload_data,
size_t *upload_data_size)
{
- struct MHD_Response *response;
- int ret;
-
+ (void) connection_cls;
+ (void) upload_data;
+ (void) upload_data_size;
if (0 == rh->data_size)
rh->data_size = strlen ((const char *) rh->data);
- response = MHD_create_response_from_buffer (rh->data_size,
- (void *) rh->data,
- MHD_RESPMEM_PERSISTENT);
- if (NULL == response)
- {
- GNUNET_break (0);
- return MHD_NO;
- }
- TMH_RESPONSE_add_global_headers (response);
- if (NULL != rh->mime_type)
- (void) MHD_add_response_header (response,
- MHD_HTTP_HEADER_CONTENT_TYPE,
- rh->mime_type);
- ret = MHD_queue_response (connection,
- rh->response_code,
- response);
- MHD_destroy_response (response);
- return ret;
+ return TALER_MHD_reply_static (connection,
+ rh->response_code,
+ rh->mime_type,
+ (void *) rh->data,
+ rh->data_size);
}
@@ -90,67 +76,13 @@ TMH_MHD_handler_agpl_redirect (struct TMH_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;
-
- response = MHD_create_response_from_buffer (strlen (agpl),
- (void *) agpl,
- MHD_RESPMEM_PERSISTENT);
- if (NULL == response)
- {
- GNUNET_break (0);
- return MHD_NO;
- }
- TMH_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/anastasis.git"))
- {
- GNUNET_break (0);
- ret = MHD_NO;
- }
- else
- {
- ret = MHD_queue_response (connection,
- rh->response_code,
- response);
- }
- MHD_destroy_response (response);
- return ret;
-}
-
-
-/**
- * Function to call to handle the request by building a JSON
- * reply with an error message from @a rh.
- *
- * @param rh context of the handler
- * @param connection the MHD connection to handle
- * @param[in,out] connection_cls the connection's closure (can be updated)
- * @param upload_data upload data
- * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
- * @return MHD result code
- */
-int
-TMH_MHD_handler_send_json_pack_error (struct TMH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size)
-{
- return TMH_RESPONSE_reply_json_pack (connection,
- rh->response_code,
- "{s:s}",
- "error",
- rh->data);
+ (void) rh;
+ (void) connection_cls;
+ (void) upload_data;
+ (void) upload_data_size;
+ return TALER_MHD_reply_agpl (connection,
+ "http://www.git.taler.net/anastasis.git");
}
-/* end of taler-exchange-httpd_mhd.c */
+/* end of anastasis-httpd_mhd.c */
diff --git a/src/backend/anastasis-httpd_mhd.h
b/src/backend/anastasis-httpd_mhd.h
index 947ba56..ae6e26a 100644
--- a/src/backend/anastasis-httpd_mhd.h
+++ b/src/backend/anastasis-httpd_mhd.h
@@ -68,46 +68,4 @@ TMH_MHD_handler_agpl_redirect (struct TMH_RequestHandler *rh,
size_t *upload_data_size);
-/**
- * Function to call to handle the request by building a JSON
- * reply from varargs.
- *
- * @param rh context of the handler
- * @param connection the MHD connection to handle
- * @param[in,out] connection_cls the connection's closure (can be updated)
- * @param response_code HTTP response code to use
- * @param do_cache can the response be cached? (0: no, 1: yes)
- * @param fmt format string for pack
- * @param ... varargs
- * @return MHD result code
- */
-int
-TMH_MHD_helper_send_json_pack (struct TMH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void *connection_cls,
- int response_code,
- int do_cache,
- const char *fmt,
- ...);
-
-
-/**
- * Function to call to handle the request by building a JSON
- * reply with an error message from @a rh.
- *
- * @param rh context of the handler
- * @param connection the MHD connection to handle
- * @param[in,out] connection_cls the connection's closure (can be updated)
- * @param upload_data upload data
- * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
- * @return MHD result code
- */
-int
-TMH_MHD_handler_send_json_pack_error (struct TMH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size);
-
-
#endif
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: use more of libtalermhd,
gnunet <=