diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-11-23 18:47:07 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-11-23 18:47:07 +0100 |
commit | e8a88392da98c3325ba39b20901a5c220158d1f5 (patch) | |
tree | b2e43949d8ec80d0a24a256479a67547e4a3730f /src/auditor | |
parent | 8bca461ea9f604e4bce279255663f207f0d104ac (diff) |
more refactoring towards using libtalermhd
Diffstat (limited to 'src/auditor')
-rw-r--r-- | src/auditor/Makefile.am | 2 | ||||
-rw-r--r-- | src/auditor/taler-auditor-httpd.c | 19 | ||||
-rw-r--r-- | src/auditor/taler-auditor-httpd_mhd.c | 40 | ||||
-rw-r--r-- | src/auditor/taler-auditor-httpd_responses.c | 3 |
4 files changed, 19 insertions, 45 deletions
diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am index c04fb167e..6d0c81582 100644 --- a/src/auditor/Makefile.am +++ b/src/auditor/Makefile.am @@ -23,7 +23,6 @@ taler_auditor_dbinit_SOURCES = \ taler-auditor-dbinit.c taler_auditor_dbinit_LDADD = \ $(LIBGCRYPT_LIBS) \ - $(top_builddir)/src/mhd/libtalermhd.la \ $(top_builddir)/src/util/libtalerutil.la \ $(top_builddir)/src/pq/libtalerpq.la \ $(top_builddir)/src/auditordb/libtalerauditordb.la \ @@ -58,6 +57,7 @@ taler_auditor_httpd_SOURCES = \ taler-auditor-httpd_responses.c taler-auditor-httpd_responses.h taler_auditor_httpd_LDADD = \ $(LIBGCRYPT_LIBS) \ + $(top_builddir)/src/mhd/libtalermhd.la \ $(top_builddir)/src/util/libtalerutil.la \ $(top_builddir)/src/json/libtalerjson.la \ $(top_builddir)/src/wire/libtalerwire.la \ diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c index f0e735c01..fa4f572ec 100644 --- a/src/auditor/taler-auditor-httpd.c +++ b/src/auditor/taler-auditor-httpd.c @@ -385,7 +385,7 @@ handle_mhd_request (void *cls, &TAH_MHD_handler_static_response, MHD_HTTP_OK }, /* AGPL licensing page, redirect to source. As per the AGPL-license, every deployment is required to offer the user a download of the - source. We make this easy by including a redirect to the source + source. We make this easy by including a redirect t the source here. */ { "/agpl", MHD_HTTP_METHOD_GET, "text/plain", NULL, 0, @@ -393,11 +393,6 @@ handle_mhd_request (void *cls, { NULL, NULL, NULL, NULL, 0, 0 } }; - static struct TAH_RequestHandler h404 = { - "", NULL, "text/html", - "<html><title>404: not found</title></html>", 0, - &TAH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND - }; struct TAH_RequestHandler *rh; GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -420,11 +415,13 @@ handle_mhd_request (void *cls, upload_data, upload_data_size); } - return TAH_MHD_handler_static_response (&h404, - connection, - con_cls, - upload_data, - upload_data_size); +#define NOT_FOUND "<html><title>404: not found</title></html>" + return TALER_MHD_reply_static (connection, + MHD_HTTP_NOT_FOUND, + "text/html", + NOT_FOUND, + strlen (NOT_FOUND)); +#undef NOT_FOUND } diff --git a/src/auditor/taler-auditor-httpd_mhd.c b/src/auditor/taler-auditor-httpd_mhd.c index 5f13691f5..6613ddb0d 100644 --- a/src/auditor/taler-auditor-httpd_mhd.c +++ b/src/auditor/taler-auditor-httpd_mhd.c @@ -28,6 +28,8 @@ #include <jansson.h> #include <microhttpd.h> #include <pthread.h> +#include "taler_mhd_lib.h" +#include "taler-auditor-httpd_responses.h" #include "taler-auditor-httpd_responses.h" #include "taler-auditor-httpd.h" #include "taler-auditor-httpd_mhd.h" @@ -94,38 +96,12 @@ TAH_MHD_handler_agpl_redirect (struct TAH_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; - } - TAH_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=auditor.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; + (void) rh; + (void) connection_cls; + (void) upload_data; + (void) upload_data_size; + return TALER_MHD_reply_agpl (connection, + "http://www.git.taler.net/?p=exchange.git"); } diff --git a/src/auditor/taler-auditor-httpd_responses.c b/src/auditor/taler-auditor-httpd_responses.c index 4c7b429e3..2f78fb0f5 100644 --- a/src/auditor/taler-auditor-httpd_responses.c +++ b/src/auditor/taler-auditor-httpd_responses.c @@ -14,7 +14,7 @@ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ /** - * @file taler-exchange-httpd_responses.c + * @file taler-auditor-httpd_responses.c * @brief API for generating genric replies of the exchange; these * functions are called TAH_RESPONSE_reply_ and they generate * and queue MHD response objects for a given connection. @@ -24,6 +24,7 @@ */ #include "platform.h" #include <zlib.h> +#include "taler_mhd_lib.h" #include "taler-auditor-httpd_responses.h" #include "taler_util.h" #include "taler_json_lib.h" |