challenger

OAuth 2.0-based authentication service that validates user can receive messages at a certain address
Log | Files | Refs | Submodules | README | LICENSE

challenger-httpd_mhd.c (1844B)


      1 /*
      2   This file is part of Challenger
      3   Copyright (C) 2023 Taler Systems SA
      4 
      5   Challenger 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   Challenger 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   Challenger; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15 */
     16 /**
     17  * @file challenger-httpd_mhd.c
     18  * @brief helpers for MHD interaction
     19  * @author Christian Grothoff
     20  */
     21 #include "platform.h"
     22 #include <jansson.h>
     23 #include "challenger-httpd_mhd.h"
     24 
     25 
     26 enum MHD_Result
     27 CH_MHD_handler_root (struct CH_HandlerContext *hc,
     28                      const char *upload_data,
     29                      size_t *upload_data_size)
     30 {
     31   const char *msg =
     32     "Hello, I'm challenger. This HTTP server is not for humans.\n";
     33 
     34   (void) upload_data;
     35   (void) upload_data_size;
     36   return TALER_MHD_reply_static (hc->connection,
     37                                  MHD_HTTP_OK,
     38                                  "text/plain",
     39                                  msg,
     40                                  strlen (msg));
     41 }
     42 
     43 
     44 enum MHD_Result
     45 CH_MHD_handler_agpl_redirect (struct CH_HandlerContext *hc,
     46                               const char *upload_data,
     47                               size_t *upload_data_size)
     48 {
     49   (void) upload_data;
     50   (void) upload_data_size;
     51   return TALER_MHD_reply_agpl (hc->connection,
     52                                "https://git.taler.net/challenger.git");
     53 }
     54 
     55 
     56 /* end of challenger-httpd_mhd.c */