sync

Backup service to store encrypted wallet databases (experimental)
Log | Files | Refs | Submodules | README | LICENSE

sync-httpd_mhd.c (2399B)


      1 /*
      2   This file is part of TALER
      3   Copyright (C) 2014, 2015, 2016 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  * @file sync-httpd_mhd.c
     18  * @brief helpers for MHD interaction; these are TALER_EXCHANGE_handler_ functions
     19  *        that generate simple MHD replies that do not require any real operations
     20  *        to be performed (error handling, static pages, etc.)
     21  * @author Florian Dold
     22  * @author Benedikt Mueller
     23  * @author Christian Grothoff
     24  */
     25 #include "platform.h"
     26 #include <jansson.h>
     27 #include "sync-httpd_mhd.h"
     28 
     29 
     30 enum MHD_Result
     31 SH_MHD_handler_static_response (struct SH_RequestHandler *rh,
     32                                 struct MHD_Connection *connection,
     33                                 void **connection_cls,
     34                                 const char *upload_data,
     35                                 size_t *upload_data_size)
     36 {
     37   (void) connection_cls;
     38   (void) upload_data;
     39   (void) upload_data_size;
     40   if (0 == rh->data_size)
     41     rh->data_size = strlen ((const char *) rh->data);
     42   return TALER_MHD_reply_static (connection,
     43                                  rh->response_code,
     44                                  rh->mime_type,
     45                                  (void *) rh->data,
     46                                  rh->data_size);
     47 }
     48 
     49 
     50 enum MHD_Result
     51 SH_MHD_handler_agpl_redirect (struct SH_RequestHandler *rh,
     52                               struct MHD_Connection *connection,
     53                               void **connection_cls,
     54                               const char *upload_data,
     55                               size_t *upload_data_size)
     56 {
     57   (void) rh;
     58   (void) connection_cls;
     59   (void) upload_data;
     60   (void) upload_data_size;
     61   return TALER_MHD_reply_agpl (connection,
     62                                "http://www.git.taler.net/sync.git");
     63 }
     64 
     65 
     66 /* end of sync-httpd_mhd.c */