aboutsummaryrefslogtreecommitdiff
path: root/examples/fastcgi.todo
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2020-03-17 23:27:44 +0300
committerAleksey Veresov <aleksey@veresov.pro>2020-03-17 23:27:44 +0300
commit1d8e7d8ef36de7bae2c62f63bec0e9914f18e77d (patch)
tree79e049c3204216d99199e5d4f299b79c0547037c /examples/fastcgi.todo
parentd9f19275d0549c4b9c3402e1fd28c71627507557 (diff)
downloadmagi-1d8e7d8ef36de7bae2c62f63bec0e9914f18e77d.tar
magi-1d8e7d8ef36de7bae2c62f63bec0e9914f18e77d.tar.xz
magi-1d8e7d8ef36de7bae2c62f63bec0e9914f18e77d.zip
[magi]
Diffstat (limited to 'examples/fastcgi.todo')
-rw-r--r--examples/fastcgi.todo34
1 files changed, 34 insertions, 0 deletions
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 <magi.h>
+
+
+void response(magi_request *r)
+{
+ magi_response(r,
+ "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' "
+ "'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>"
+ "<html xmlns='http://www.w3.org/1999/xhtml'>"
+ "<head><title>Fast CGI</title></head>"
+ "<body>Hi!</body>"
+ "</html>");
+}
+
+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;
+}