Line data Source code
1 : /* 2 : This file is part of TALER 3 : Copyright (C) 2014-2020 Taler Systems SA 4 : 5 : TALER is free software; you can redistribute it and/or modify it under the 6 : terms of the GNU Affero General Public License as published by the Free Software 7 : Foundation; either version 3, or (at your option) any later version. 8 : 9 : TALER is distributed in the hope that it will be useful, but WITHOUT ANY 10 : WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 : A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. 12 : 13 : You should have received a copy of the GNU Affero General Public License along with 14 : TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 : */ 16 : 17 : /** 18 : * @file taler-auditor-httpd_mhd.c 19 : * @brief helpers for MHD interaction; these are TALER_MHD_handler_ functions 20 : * that generate simple MHD replies that do not require any real operations 21 : * to be performed (error handling, static pages, etc.) 22 : * @author Florian Dold 23 : * @author Benedikt Mueller 24 : * @author Christian Grothoff 25 : */ 26 : #include "platform.h" 27 : #include <gnunet/gnunet_util_lib.h> 28 : #include <jansson.h> 29 : #include <microhttpd.h> 30 : #include <pthread.h> 31 : #include "taler_mhd_lib.h" 32 : #include "taler-auditor-httpd.h" 33 : #include "taler-auditor-httpd_mhd.h" 34 : 35 : 36 : MHD_RESULT 37 1 : TAH_MHD_handler_static_response (struct TAH_RequestHandler *rh, 38 : struct MHD_Connection *connection, 39 : void **connection_cls, 40 : const char *upload_data, 41 : size_t *upload_data_size, 42 : const char *const args[]) 43 : { 44 : size_t dlen; 45 : 46 : (void) connection_cls; 47 : (void) upload_data; 48 : (void) upload_data_size; 49 2 : dlen = (0 == rh->data_size) 50 1 : ? strlen ((const char *) rh->data) 51 1 : : rh->data_size; 52 2 : return TALER_MHD_reply_static (connection, 53 : rh->response_code, 54 : rh->mime_type, 55 1 : rh->data, 56 : dlen); 57 : } 58 : 59 : 60 : MHD_RESULT 61 0 : TAH_MHD_handler_agpl_redirect (struct TAH_RequestHandler *rh, 62 : struct MHD_Connection *connection, 63 : void **connection_cls, 64 : const char *upload_data, 65 : size_t *upload_data_size, 66 : const char *const args[]) 67 : { 68 : (void) rh; 69 : (void) connection_cls; 70 : (void) upload_data; 71 : (void) upload_data_size; 72 0 : return TALER_MHD_reply_agpl (connection, 73 : "http://www.git.taler.net/?p=exchange.git"); 74 : } 75 : 76 : 77 : /* end of taler-auditor-httpd_mhd.c */