From 4f1b2ecaf2b9d2f5dc5ae28f6e7e5a20addbb5a6 Mon Sep 17 00:00:00 2001 From: "ng0@n0.is" Date: Fri, 7 Jun 2019 09:56:31 +0000 Subject: add mrg.c --- mrg.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 mrg.c diff --git a/mrg.c b/mrg.c new file mode 100644 index 0000000..e7b5bea --- /dev/null +++ b/mrg.c @@ -0,0 +1,55 @@ +#include +#include +#include +#include + +static int +answer_to_connection (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **con_cls) +{ + const char *body = "\ +

\ + Hello, ick bins eins HTML body!
\ + Ia! Ia! Cthulhu fhtagn! Ph'nglui mglw'nfah Cthulhu R'lyeh wgah'nagl fhtagn!\ + Ia! Ia! Cthulhu fhtagn! Ph'nglui mglw'nfah Cthulhu R'lyeh wgah'nagl fhtagn!\ + Ia! Ia! Cthulhu fhtagn! Ph'nglui mglw'nfah Cthulhu R'lyeh wgah'nagl fhtagn!\ + Ia! Ia! Cthulhu fhtagn! Ph'nglui mglw'nfah Cthulhu R'lyeh wgah'nagl fhtagn!\ + Ia! Ia! Cthulhu fhtagn! Ph'nglui mglw'nfah Cthulhu R'lyeh wgah'nagl fhtagn!\ + Ia! Ia! Cthulhu fhtagn! Ph'nglui mglw'nfah Cthulhu R'lyeh wgah'nagl fhtagn!\ + Ia! Ia! Cthulhu fhtagn! Ph'nglui mglw'nfah Cthulhu R'lyeh wgah'nagl fhtagn!\ + Ia! Ia! Cthulhu fhtagn! Ph'nglui mglw'nfah Cthulhu R'lyeh wgah'nagl fhtagn!\ +

\ + "; + int ret; + struct MHD_Response *response = + MHD_create_response_from_buffer (strlen (body), + (void *) body, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + +int +main () +{ + struct MHD_Daemon *daemon = + MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD, + 8888, + NULL, + NULL, + &answer_to_connection, + NULL, + MHD_OPTION_END); + if (NULL == daemon) + return 1; + (void) getchar (); + MHD_stop_daemon (daemon); + return 0; +} -- cgit v1.2.3