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/echo.c | |
parent | e6d5f9552e66ee2db3056e810b58b2bf82551356 (diff) | |
download | magi-32c1fbd2cf779a65e807d0d82412ffffa2401962.tar magi-32c1fbd2cf779a65e807d0d82412ffffa2401962.tar.xz magi-32c1fbd2cf779a65e807d0d82412ffffa2401962.zip |
[magi]
Diffstat (limited to 'examples/echo.c')
-rw-r--r-- | examples/echo.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/examples/echo.c b/examples/echo.c index 853e6ce..6901b71 100644 --- a/examples/echo.c +++ b/examples/echo.c @@ -6,8 +6,8 @@ #include <stdlib.h> -void proceed_cookies( - struct magi_cookie_list * cookies, struct magi_response * response) +void proceed_cookies(struct magi_cookie_list * cookies, + struct magi_response * response) { magi_response_content(response, "<h2>Cookies:</h2>"); while (cookies) { @@ -35,8 +35,8 @@ void proceed_cookies( magi_response_content(response, "<hr/>"); } -void proceed_fields( - struct magi_field_list * fields, struct magi_response * response) +void proceed_fields(struct magi_field_list * fields, + struct magi_response * response) { magi_response_content(response, "<h2>Feilds:</h2>"); while (fields) { @@ -50,8 +50,8 @@ void proceed_fields( magi_response_content(response, "<hr/>"); } -void proceed_params( - struct magi_param_list * params, struct magi_response * response) +void proceed_params(struct magi_param_list * params, + struct magi_response * response) { magi_response_content(response, "<h2>HTTP Parameters:</h2>"); while (params) { @@ -67,9 +67,8 @@ void proceed_params( void process_meta(struct magi_request * req, struct magi_response * res) { - magi_response_content(res, - "<h1>Echo CGI Script</h1>" - "I was called with method ["); + magi_response_content(res, "<h1>Echo CGI Script</h1>" + "I was called with method ["); magi_response_content(res, req->method); if (req->uri) { magi_response_content(res, "] with URL ["); @@ -97,12 +96,12 @@ void process_meta(struct magi_request * req, struct magi_response * res) void response_request(struct magi_request * req, struct magi_response * 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>Echo</title></head>" - "<body>"); + 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>Echo</title></head>" + "<body>"); process_meta(req, res); proceed_cookies(req->cookies, res); proceed_fields(req->fields, res); |