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-exchange-httpd_mhd.c 19 : * @brief helpers for MHD interaction; these are TALER_EXCHANGE_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-exchange-httpd_responses.h" 33 : #include "taler-exchange-httpd.h" 34 : #include "taler-exchange-httpd_mhd.h" 35 : 36 : 37 : MHD_RESULT 38 0 : TEH_handler_static_response (struct TEH_RequestContext *rc, 39 : const char *const args[]) 40 : { 41 0 : const struct TEH_RequestHandler *rh = rc->rh; 42 : size_t dlen; 43 : 44 : (void) args; 45 0 : dlen = (0 == rh->data_size) 46 0 : ? strlen ((const char *) rh->data) 47 0 : : rh->data_size; 48 0 : return TALER_MHD_reply_static (rc->connection, 49 : rh->response_code, 50 : rh->mime_type, 51 0 : rh->data, 52 : dlen); 53 : } 54 : 55 : 56 : MHD_RESULT 57 0 : TEH_handler_agpl_redirect (struct TEH_RequestContext *rc, 58 : const char *const args[]) 59 : { 60 : (void) args; 61 0 : return TALER_MHD_reply_agpl (rc->connection, 62 : "https://git.taler.net/?p=exchange.git"); 63 : } 64 : 65 : 66 : /* end of taler-exchange-httpd_mhd.c */