donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

donau-httpd_mhd.c (2135B)


      1 /*
      2   This file is part of TALER
      3   Copyright (C) 2024 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 donau-httpd_mhd.c
     19  * @brief helpers for MHD interaction; these are DONAU_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 <donau_config.h>
     27 #include <gnunet/gnunet_util_lib.h>
     28 #include <jansson.h>
     29 #include <microhttpd.h>
     30 #include <pthread.h>
     31 #include <taler/taler_mhd_lib.h>
     32 #include "donau-httpd_responses.h"
     33 #include "donau-httpd.h"
     34 #include "donau-httpd_mhd.h"
     35 
     36 
     37 enum MHD_Result
     38 DH_handler_static_response (struct DH_RequestContext *rc,
     39                             const char *const args[])
     40 {
     41   const struct DH_RequestHandler *rh = rc->rh;
     42   size_t dlen;
     43 
     44   (void) args;
     45   dlen = (0 == rh->data_size)
     46          ? strlen ((const char *) rh->data)
     47          : rh->data_size;
     48   return TALER_MHD_reply_static (rc->connection,
     49                                  rh->response_code,
     50                                  rh->mime_type,
     51                                  rh->data,
     52                                  dlen);
     53 }
     54 
     55 
     56 enum MHD_Result
     57 DH_handler_agpl_redirect (struct DH_RequestContext *rc,
     58                           const char *const args[])
     59 {
     60   (void) args;
     61   return TALER_MHD_reply_agpl (rc->connection,
     62                                "https://git.taler.net/?p=donau.git");
     63 }
     64 
     65 
     66 /* end of donau-httpd_mhd.c */