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 <gnunet/gnunet_util_lib.h>
27 : #include <jansson.h>
28 : #include <microhttpd.h>
29 : #include <pthread.h>
30 : #include "taler/taler_mhd_lib.h"
31 : #include "taler-auditor-httpd.h"
32 : #include "taler-auditor-httpd_mhd.h"
33 :
34 :
35 : MHD_RESULT
36 1 : TAH_MHD_handler_static_response (struct TAH_RequestHandler *rh,
37 : struct MHD_Connection *connection,
38 : void **connection_cls,
39 : const char *upload_data,
40 : size_t *upload_data_size,
41 : const char *const args[])
42 : {
43 : size_t dlen;
44 :
45 : (void) connection_cls;
46 : (void) upload_data;
47 : (void) upload_data_size;
48 2 : dlen = (0 == rh->data_size)
49 1 : ? strlen ((const char *) rh->data)
50 1 : : rh->data_size;
51 2 : return TALER_MHD_reply_static (connection,
52 : rh->response_code,
53 : rh->mime_type,
54 1 : rh->data,
55 : dlen);
56 : }
57 :
58 :
59 : MHD_RESULT
60 0 : TAH_MHD_handler_agpl_redirect (struct TAH_RequestHandler *rh,
61 : struct MHD_Connection *connection,
62 : void **connection_cls,
63 : const char *upload_data,
64 : size_t *upload_data_size,
65 : const char *const args[])
66 : {
67 : (void) rh;
68 : (void) connection_cls;
69 : (void) upload_data;
70 : (void) upload_data_size;
71 0 : return TALER_MHD_reply_agpl (connection,
72 : "http://www.git.taler.net/?p=exchange.git");
73 : }
74 :
75 :
76 : /* end of taler-auditor-httpd_mhd.c */
|