diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2020-03-09 20:17:28 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2020-03-09 20:17:28 +0300 |
commit | 5cfe6cdf6af2d630d21871f9193fc1b4a7db24ff (patch) | |
tree | b50c9c0936a8dab87519dcd9e47ed40759d7eddc /src/response.c | |
parent | 18ce121d4243358bc55a0474a529efe2580a0610 (diff) | |
download | magi-5cfe6cdf6af2d630d21871f9193fc1b4a7db24ff.tar magi-5cfe6cdf6af2d630d21871f9193fc1b4a7db24ff.tar.xz magi-5cfe6cdf6af2d630d21871f9193fc1b4a7db24ff.zip |
[magi]
Diffstat (limited to 'src/response.c')
-rw-r--r-- | src/response.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/response.c b/src/response.c index 403e0fe..aea64b4 100644 --- a/src/response.c +++ b/src/response.c @@ -115,6 +115,7 @@ void magi_response_head(magi_request *r) response_headers(r->response, r->response->head[0]); response_headers(r->response, r->response->head[1]); response_headers(r->response, r->response->head[2]); + r->response->methods->start_body(r->response->userdata); r->response->head_done = 1; } @@ -135,3 +136,20 @@ void magi_response_file(magi_request *r, FILE *file) magi_response_head(r); r->response->methods->file(r->response->userdata, file); } + + +void magi_response_error(magi_request *r) +{ + /* TODO */ + magi_response_status(r, 400, "Bad Request"); + 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>400 Bad Request</title></head>" + "<body>" + "<h1>400 <i>Bad Request</i></h1>" + "<h2>"); + magi_response(r, magi_error_message(r->error)); + magi_response(r, "</h2></body></html>"); +} |