From 787ef64ce61302a159ad48974272533b6fdf6c9e Mon Sep 17 00:00:00 2001 From: justanothercatgirl Date: Mon, 24 Mar 2025 08:21:04 +0300 Subject: initial commit --- endpoints.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 endpoints.c (limited to 'endpoints.c') 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 +#include + +#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 = "This is an index page!"; + return duplicate(resp); +} + +// home, path: /home +char* _home(struct MHD_Connection* connection) { + const char* resp = "" + "

This is a HOME page!

" + "
" + "Don't click me! :0" + ""; + return duplicate(resp); +} + +// hentai, path: /hidden/hentai +char* _hidden_hentai(struct MHD_Connection* connection) { + const char* resp = "" + "

what did you expect to see...

" + " " + ""; + return duplicate(resp); +} -- cgit v1.2.3-70-g09d2