[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-challenger] branch master updated: end endpoints for /agpl and /m
From: |
gnunet |
Subject: |
[taler-challenger] branch master updated: end endpoints for /agpl and /main.css |
Date: |
Tue, 14 Nov 2023 16:57:59 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository challenger.
The following commit(s) were added to refs/heads/master by this push:
new fe9a7e7 end endpoints for /agpl and /main.css
fe9a7e7 is described below
commit fe9a7e785d8136cdebf64e7385eefdd0cb0f14a6
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Nov 14 16:57:16 2023 +0100
end endpoints for /agpl and /main.css
---
src/challenger/Makefile.am | 2 +
src/challenger/challenger-httpd.c | 15 +++--
src/challenger/challenger-httpd_agpl.c | 37 ++++++++++++
src/challenger/challenger-httpd_agpl.h | 41 +++++++++++++
src/challenger/challenger-httpd_main_css.c | 92 ++++++++++++++++++++++++++++++
src/challenger/challenger-httpd_main_css.h | 41 +++++++++++++
6 files changed, 224 insertions(+), 4 deletions(-)
diff --git a/src/challenger/Makefile.am b/src/challenger/Makefile.am
index 110e464..f5d9842 100644
--- a/src/challenger/Makefile.am
+++ b/src/challenger/Makefile.am
@@ -37,11 +37,13 @@ challenger_admin_LDADD = \
challenger_httpd_SOURCES = \
challenger-httpd.c challenger-httpd.h \
+ challenger-httpd_agpl.c challenger-httpd_agpl.h \
challenger-httpd_authorize.c challenger-httpd_authorize.h \
challenger-httpd_challenge.c challenger-httpd_challenge.h \
challenger-httpd_common.c challenger-httpd_common.h \
challenger-httpd_config.c challenger-httpd_config.h \
challenger-httpd_info.c challenger-httpd_info.h \
+ challenger-httpd_main_css.c challenger-httpd_main_css.h \
challenger-httpd_mhd.c challenger-httpd_mhd.h \
challenger-httpd_setup.c challenger-httpd_setup.h \
challenger-httpd_solve.c challenger-httpd_solve.h \
diff --git a/src/challenger/challenger-httpd.c
b/src/challenger/challenger-httpd.c
index f36747b..06974d0 100644
--- a/src/challenger/challenger-httpd.c
+++ b/src/challenger/challenger-httpd.c
@@ -24,15 +24,17 @@
#include <gnunet/gnunet_curl_lib.h>
#include "challenger_util.h"
#include "challenger-httpd.h"
+#include "challenger-httpd_agpl.h"
+#include "challenger-httpd_authorize.h"
#include "challenger-httpd_challenge.h"
+#include "challenger-httpd_config.h"
#include "challenger-httpd_info.h"
-#include "challenger-httpd_setup.h"
-#include "challenger-httpd_authorize.h"
+#include "challenger-httpd_main_css.h"
#include "challenger-httpd_mhd.h"
+#include "challenger-httpd_setup.h"
#include "challenger-httpd_solve.h"
#include "challenger-httpd_token.h"
#include "challenger_database_lib.h"
-#include "challenger-httpd_config.h"
#include <taler/taler_templating_lib.h>
@@ -164,7 +166,12 @@ url_handler (void *cls,
{
.url = "/agpl",
.method = MHD_HTTP_METHOD_GET,
- .handler = &CH_handler_config
+ .handler = &CH_handler_agpl
+ },
+ {
+ .url = "/main.css",
+ .method = MHD_HTTP_METHOD_GET,
+ .handler = &CH_handler_main_css
},
{
.url = "/config",
diff --git a/src/challenger/challenger-httpd_agpl.c
b/src/challenger/challenger-httpd_agpl.c
new file mode 100644
index 0000000..e316b4a
--- /dev/null
+++ b/src/challenger/challenger-httpd_agpl.c
@@ -0,0 +1,37 @@
+/*
+ This file is part of Challenger
+ Copyright (C) 2023 Taler Systems SA
+
+ Challenger is free software; you can redistribute it and/or modify it under
the
+ terms of the GNU Lesser General Public License as published by the Free
Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ Challenger is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ Challenger; see the file COPYING.GPL. If not, see
<http://www.gnu.org/licenses/>
+*/
+/**
+ * @file challenger/challenger-httpd_agpl.c
+ * @brief headers for /agpl handler
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "challenger-httpd_agpl.h"
+#include <taler/taler_mhd_lib.h>
+
+
+MHD_RESULT
+CH_handler_agpl (struct CH_HandlerContext *hc,
+ const char *upload_data,
+ size_t *upload_data_size)
+{
+ return TALER_MHD_reply_agpl (
+ hc->connection,
+ "https://git.taler.net/challenger.git/");
+}
+
+
+/* end of challenger-httpd_agpl.c */
diff --git a/src/challenger/challenger-httpd_agpl.h
b/src/challenger/challenger-httpd_agpl.h
new file mode 100644
index 0000000..f95cf3e
--- /dev/null
+++ b/src/challenger/challenger-httpd_agpl.h
@@ -0,0 +1,41 @@
+/*
+ This file is part of Challenger
+ Copyright (C) 2023 Taler Systems SA
+
+ Challenger is free software; you can redistribute it and/or modify it under
the
+ terms of the GNU Lesser General Public License as published by the Free
Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ Challenger is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ Challenger; see the file COPYING.GPL. If not, see
<http://www.gnu.org/licenses/>
+*/
+/**
+ * @file challenger/challenger-httpd_agpl.h
+ * @brief headers for /agpl handler
+ * @author Christian Grothoff
+ */
+#ifndef CHALLENGER_HTTPD_AGPL_H
+#define CHALLENGER_HTTPD_AGPL_H
+#include <microhttpd.h>
+#include "challenger-httpd.h"
+
+/**
+ * Manages a /agpl call.
+ *
+ * @param[in,out] hc context of the connection
+ * @param upload_data upload data
+ * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
+ * @return MHD result code
+ */
+MHD_RESULT
+CH_handler_agpl (struct CH_HandlerContext *hc,
+ const char *upload_data,
+ size_t *upload_data_size);
+
+#endif
+
+/* end of challenger-httpd_agpl.h */
diff --git a/src/challenger/challenger-httpd_main_css.c
b/src/challenger/challenger-httpd_main_css.c
new file mode 100644
index 0000000..a08dede
--- /dev/null
+++ b/src/challenger/challenger-httpd_main_css.c
@@ -0,0 +1,92 @@
+/*
+ This file is part of Challenger
+ Copyright (C) 2023 Taler Systems SA
+
+ Challenger is free software; you can redistribute it and/or modify it under
the
+ terms of the GNU Lesser General Public License as published by the Free
Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ Challenger is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ Challenger; see the file COPYING.GPL. If not, see
<http://www.gnu.org/licenses/>
+*/
+/**
+ * @file challenger/challenger-httpd_main_css.c
+ * @brief handler for /main.css
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "challenger-httpd_main_css.h"
+#include <taler/taler_mhd_lib.h>
+
+
+MHD_RESULT
+CH_handler_main_css (struct CH_HandlerContext *hc,
+ const char *upload_data,
+ size_t *upload_data_size)
+{
+ static struct MHD_Response *reply;
+
+ if (NULL == reply)
+ {
+ char *fn;
+ struct stat sb;
+ int fd;
+ char *path;
+
+ path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
+ if (NULL == path)
+ {
+ GNUNET_break (0);
+ return MHD_NO;
+ }
+ GNUNET_asprintf (&fn,
+ "%s/main.css",
+ path);
+ GNUNET_free (path);
+ fd = open (fn,
+ O_RDONLY);
+ if (-1 == fd)
+ {
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+ "open",
+ fn);
+ GNUNET_free (fn);
+ return GNUNET_SYSERR;
+ }
+ if (0 !=
+ fstat (fd,
+ &sb))
+ {
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+ "fstat",
+ fn);
+ GNUNET_break (0 == close (fd));
+ GNUNET_free (fn);
+ return GNUNET_OK;
+ }
+ GNUNET_free (fn);
+ reply = MHD_create_response_from_fd (sb.st_size,
+ fd);
+ TALER_MHD_add_global_headers (reply);
+ GNUNET_break (MHD_NO !=
+ MHD_add_response_header (reply,
+ MHD_HTTP_HEADER_CONTENT_TYPE,
+ "text/css"));
+ }
+ if (NULL == reply)
+ {
+ GNUNET_break (0);
+ return MHD_NO;
+ }
+ return MHD_queue_response (
+ hc->connection,
+ MHD_HTTP_OK,
+ reply);
+}
+
+
+/* end of challenger-httpd_main_css.c */
diff --git a/src/challenger/challenger-httpd_main_css.h
b/src/challenger/challenger-httpd_main_css.h
new file mode 100644
index 0000000..7a6f620
--- /dev/null
+++ b/src/challenger/challenger-httpd_main_css.h
@@ -0,0 +1,41 @@
+/*
+ This file is part of Challenger
+ Copyright (C) 2023 Taler Systems SA
+
+ Challenger is free software; you can redistribute it and/or modify it under
the
+ terms of the GNU Lesser General Public License as published by the Free
Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ Challenger is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ Challenger; see the file COPYING.GPL. If not, see
<http://www.gnu.org/licenses/>
+*/
+/**
+ * @file challenger/challenger-httpd_main_css.h
+ * @brief headers for /main_css handler
+ * @author Christian Grothoff
+ */
+#ifndef CHALLENGER_HTTPD_MAIN_CSS_H
+#define CHALLENGER_HTTPD_MAIN_CSS_H
+#include <microhttpd.h>
+#include "challenger-httpd.h"
+
+/**
+ * Manages a GET /main.css request.
+ *
+ * @param[in,out] hc context of the connection
+ * @param upload_data upload data
+ * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
+ * @return MHD result code
+ */
+MHD_RESULT
+CH_handler_main_css (struct CH_HandlerContext *hc,
+ const char *upload_data,
+ size_t *upload_data_size);
+
+#endif
+
+/* end of challenger-httpd_main_css.h */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-challenger] branch master updated: end endpoints for /agpl and /main.css,
gnunet <=