From 1d8e7d8ef36de7bae2c62f63bec0e9914f18e77d Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Tue, 17 Mar 2020 23:27:44 +0300 Subject: [magi] --- examples/fastcgi.todo | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 examples/fastcgi.todo (limited to 'examples/fastcgi.todo') diff --git a/examples/fastcgi.todo b/examples/fastcgi.todo new file mode 100644 index 0000000..5d3c4b1 --- /dev/null +++ b/examples/fastcgi.todo @@ -0,0 +1,34 @@ +#include + + +void response(magi_request *r) +{ + magi_response(r, + "" + "" + "Fast CGI" + "Hi!" + ""); +} + +int main(int argc, char const *argv[]) +{ + magi_session session; + magi_request request; + magi_request_init(&request); + magi_session_init(&session); + magi_session_inet(&session, "localhost", "9973"); + magi_session_unix(&session, "unix.sock"); + while (magi_fastcgi(&session, &request)) { + if (request.error) { + magi_response_error(&request); + } else { + response(&request); + } + magi_request_free(&request); + } + magi_request_free(&request); + magi_session_free(&session); + return 0; +} -- cgit v1.2.3