aboutsummaryrefslogtreecommitdiffstats
path: root/endpoints.c
diff options
context:
space:
mode:
authorjustanothercatgirl <sotov@twistea.su>2025-03-24 08:21:04 +0300
committerjustanothercatgirl <sotov@twistea.su>2025-03-24 08:21:04 +0300
commit787ef64ce61302a159ad48974272533b6fdf6c9e (patch)
tree94d1641a6b8d5e541ec1a9c6eafe9be15b3e4a91 /endpoints.c
initial commit
Diffstat (limited to 'endpoints.c')
-rw-r--r--endpoints.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/endpoints.c b/endpoints.c
new file mode 100644
index 0000000..9a02098
--- /dev/null
+++ b/endpoints.c
@@ -0,0 +1,38 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "microhttpd.h"
+
+// not accessible in browser because ALL URLs start with / (or with _ in dylib)
+char* duplicate(const char* x) {
+ size_t len = strlen(x);
+ char* ret = malloc(len+1);
+ memcpy(ret, x, len);
+ ret[len] = '\0';
+ return ret;
+}
+
+// index, path: /
+char* _(struct MHD_Connection* connection) {
+ const char* resp = "<html><body>This is an index page!</body></html>";
+ return duplicate(resp);
+}
+
+// home, path: /home
+char* _home(struct MHD_Connection* connection) {
+ const char* resp = "<html><body>"
+ "<h1>This is a HOME page!</h1>"
+ "<div style=\"height:10000px;\"></div>"
+ "<a href=\"/hidden/hentai\">Don't click me! :0</a>"
+ "</body></html>";
+ return duplicate(resp);
+}
+
+// hentai, path: /hidden/hentai
+char* _hidden_hentai(struct MHD_Connection* connection) {
+ const char* resp = "<html><style>a{text-decoration:none;}</style><body>"
+ "<p>what did you expect to see...</p>"
+ "<a href=\"https://pornhub.com\">&nbsp;</a>"
+ "</body></html>";
+ return duplicate(resp);
+}