diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2019-11-15 18:01:45 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2019-11-15 18:01:45 +0300 |
commit | 32c1fbd2cf779a65e807d0d82412ffffa2401962 (patch) | |
tree | bb0020c18a72c4622e68258d8911956ecaca3765 /examples/fcgi.c | |
parent | e6d5f9552e66ee2db3056e810b58b2bf82551356 (diff) | |
download | magi-32c1fbd2cf779a65e807d0d82412ffffa2401962.tar magi-32c1fbd2cf779a65e807d0d82412ffffa2401962.tar.xz magi-32c1fbd2cf779a65e807d0d82412ffffa2401962.zip |
[magi]
Diffstat (limited to 'examples/fcgi.c')
-rw-r--r-- | examples/fcgi.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/examples/fcgi.c b/examples/fcgi.c index 5972cdd..9cdbe90 100644 --- a/examples/fcgi.c +++ b/examples/fcgi.c @@ -1,3 +1,4 @@ +#include <error.h> #include <fastcgi.h> #include <request.h> #include <stdio.h> @@ -8,13 +9,13 @@ void response_request(struct magi_request * req, struct magi_resopnse * res) { magi_response_content_type(res, magi_xhtml); - magi_response_content(res, - "<!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>"); + magi_response_content( + res, "<!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[]) @@ -22,7 +23,7 @@ int main(int argc, char const * argv[]) struct magi_session session; if (magi_fcgi(&session)) { struct magi_request request; - while (magi_accept(&request, &session)) { + while (magi_fcgi_accept(&request, &session)) { if (!request.error) { struct magi_response response; response_request(&request, &response); @@ -33,8 +34,8 @@ int main(int argc, char const * argv[]) } magi_request_destroy(&request); } - /* Fast CGI session error */ } - /* Fast CGI session error */ + puts(session.error->message); + magi_session_destroy(&session); return 0; } |