aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2020-03-02 20:10:16 +0300
committerAleksey Veresov <aleksey@veresov.pro>2020-03-02 20:10:16 +0300
commit9d0fb8156d6122730c6007393d49a6d76a114c60 (patch)
tree4aff03474026772b7a0debb60d5a6f3bc5fd0beb
parentc65fdedc7bedfc20da73cdbfc34c22bb80139896 (diff)
downloadmagi-9d0fb8156d6122730c6007393d49a6d76a114c60.tar
magi-9d0fb8156d6122730c6007393d49a6d76a114c60.tar.xz
magi-9d0fb8156d6122730c6007393d49a6d76a114c60.zip
[magi]
-rw-r--r--Doxyfile11
-rw-r--r--examples/append.c6
-rw-r--r--examples/cookie.c6
-rw-r--r--examples/echo.c60
-rw-r--r--examples/fastcgi.c2
-rw-r--r--examples/upload.c6
-rw-r--r--include/magi/cgi.h10
-rw-r--r--include/magi/cookie.h25
-rw-r--r--include/magi/file.h23
-rw-r--r--include/magi/loadfile.h22
-rw-r--r--include/magi/param.h19
-rw-r--r--include/magi/request.h107
-rw-r--r--include/magi/response.h52
-rw-r--r--include/magi/urlenc.h4
14 files changed, 165 insertions, 188 deletions
diff --git a/Doxyfile b/Doxyfile
new file mode 100644
index 0000000..df94fc8
--- /dev/null
+++ b/Doxyfile
@@ -0,0 +1,11 @@
+PROJECT_NAME = "Magi"
+PROJECT_BRIEF = "Magi Gateway Interfaces Library"
+OUTPUT_DIRECTORY = docs
+JAVADOC_AUTOBRIEF = YES
+INLINE_SIMPLE_STRUCTS = YES
+OPTIMIZE_OUTPUT_FOR_C = YES
+TYPEDEF_HIDES_STRUCT = YES
+INPUT = include/magi
+STRIP_FROM_PATH = include/magi
+STRIP_FROM_INC_PATH = include
+GENERATE_MAN = YES
diff --git a/examples/append.c b/examples/append.c
index cafdf9c..3a32287 100644
--- a/examples/append.c
+++ b/examples/append.c
@@ -5,7 +5,7 @@
void response(magi_request *r)
{
char *data = magi_request_param(r, "addon");
- magi_response_add(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'>"
@@ -15,9 +15,9 @@ void response(magi_request *r)
FILE *file = fopen("file_to_append", "a");
fputs(data, file);
fclose(file);
- magi_response_add(r, "<p>Appended!</p>");
+ magi_response(r, "<p>Appended!</p>");
}
- magi_response_add(r,
+ magi_response(r,
"<form action='/cgi-bin/append' method='post'><fieldset>"
"<input type='text' name='addon' value='Whatever you want to add.'/>"
"<input type='submit' value='Append'/>"
diff --git a/examples/cookie.c b/examples/cookie.c
index 5bbade1..7c55ba8 100644
--- a/examples/cookie.c
+++ b/examples/cookie.c
@@ -4,7 +4,7 @@
void list_cookies(magi_request *r)
{
magi_cookies *current;
- magi_response_add(r, "Cookies:");
+ magi_response(r, "Cookies:");
for (current = r->cookies; current; current = current->next) {
magi_cookie *c = &current->item;
magi_response_format(r, "<br/>[%s] = [%s]", c->name, c->data);
@@ -14,14 +14,14 @@ void list_cookies(magi_request *r)
void response(magi_request *r)
{
magi_response_cookie(r, "cookie", "monster");
- magi_response_add(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>Cookie Listing and Setting</title></head>"
"<body><p>");
list_cookies(r);
- magi_response_add(r, "</p></body></html>");
+ magi_response(r, "</p></body></html>");
}
int main(int argc, char const *argv[])
diff --git a/examples/echo.c b/examples/echo.c
index 89230de..e3b90c7 100644
--- a/examples/echo.c
+++ b/examples/echo.c
@@ -6,21 +6,21 @@ void list_cookies(magi_request *r)
magi_cookies *current = r->cookies;
for (current = r->cookies; current; current = current->next) {
magi_cookie *c = &current->item;
- magi_response_add(r, "Cookie with name [");
- magi_response_add(r, c->name);
+ magi_response(r, "Cookie with name [");
+ magi_response(r, c->name);
if (c->data) {
- magi_response_add(r, "] is [");
- magi_response_add(r, c->data);
+ magi_response(r, "] is [");
+ magi_response(r, c->data);
}
if (c->domain) {
- magi_response_add(r, "] for domain [");
- magi_response_add(r, c->domain);
+ magi_response(r, "] for domain [");
+ magi_response(r, c->domain);
}
if (c->path) {
- magi_response_add(r, "] for path [");
- magi_response_add(r, c->path);
+ magi_response(r, "] for path [");
+ magi_response(r, c->path);
}
- magi_response_add(r, "]<br/>");
+ magi_response(r, "]<br/>");
}
}
@@ -44,59 +44,59 @@ void list_files(magi_request *r)
void show_meta(magi_request *r)
{
- magi_response_add(r, "I was called with method [");
- magi_response_add(r, r->method);
+ magi_response(r, "I was called with method [");
+ magi_response(r, r->method);
if (r->uri) {
- magi_response_add(r, "] with URL [");
- magi_response_add(r, r->uri);
+ magi_response(r, "] with URL [");
+ magi_response(r, r->uri);
}
if (r->server_name) {
- magi_response_add(r, "] for server [");
- magi_response_add(r, r->server_name);
+ magi_response(r, "] for server [");
+ magi_response(r, r->server_name);
}
if (r->server_port) {
- magi_response_add(r, "] on port [");
- magi_response_add(r, r->server_port);
+ magi_response(r, "] on port [");
+ magi_response(r, r->server_port);
}
if (r->server_protocol) {
- magi_response_add(r, "] with protocol [");
- magi_response_add(r, r->server_protocol);
+ magi_response(r, "] with protocol [");
+ magi_response(r, r->server_protocol);
}
if (r->server_software) {
- magi_response_add(r, "] and I am running on software [");
- magi_response_add(r, r->server_software);
+ magi_response(r, "] and I am running on software [");
+ magi_response(r, r->server_software);
}
- magi_response_add(r, "]<br/>");
+ magi_response(r, "]<br/>");
}
void response(magi_request *r)
{
- magi_response_add(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>Echo</title></head>"
"<body>");
- magi_response_add(r, "<h1>Echo CGI Script</h1>");
+ magi_response(r, "<h1>Echo CGI Script</h1>");
show_meta(r);
- magi_response_add(r, "<h2>Cookies:</h2>");
+ magi_response(r, "<h2>Cookies:</h2>");
list_cookies(r);
- magi_response_add(r, "<h2>Parameters:</h2>");
+ magi_response(r, "<h2>Parameters:</h2>");
list_params(r, r->params);
- magi_response_add(r, "<h2>URL Parameters:</h2>");
+ magi_response(r, "<h2>URL Parameters:</h2>");
list_params(r, r->url_params);
- magi_response_add(r, "<h2>HTTP Parameters:</h2>");
+ magi_response(r, "<h2>HTTP Parameters:</h2>");
list_params(r, r->http_params);
- magi_response_add(r, "<h2>Files:</h2>");
+ magi_response(r, "<h2>Files:</h2>");
list_files(r);
- magi_response_add(r, "</body></html>");
+ magi_response(r, "</body></html>");
}
int main(int argc, char const *argv[])
diff --git a/examples/fastcgi.c b/examples/fastcgi.c
index 2d68a3b..5d3c4b1 100644
--- a/examples/fastcgi.c
+++ b/examples/fastcgi.c
@@ -3,7 +3,7 @@
void response(magi_request *r)
{
- magi_response_add(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'>"
diff --git a/examples/upload.c b/examples/upload.c
index 158dcad..54d3a48 100644
--- a/examples/upload.c
+++ b/examples/upload.c
@@ -6,7 +6,7 @@ void response(magi_request *r)
{
char *name = magi_request_param(r, "name");
magi_file *data = magi_request_file(r, "data");
- magi_response_add(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'>"
@@ -14,9 +14,9 @@ void response(magi_request *r)
"<body>");
if (name && data) {
rename("data", name);
- magi_response_add(r, "<p>Uploaded!</p>");
+ magi_response(r, "<p>Uploaded!</p>");
}
- magi_response_add(r,
+ magi_response(r,
"<form action='/cgi-bin/upload' method='post' "
"enctype='multipart/form-data'><fieldset>"
"<input type='text' name='name' value='filename'/>"
diff --git a/include/magi/cgi.h b/include/magi/cgi.h
index 4d182b7..9b29a98 100644
--- a/include/magi/cgi.h
+++ b/include/magi/cgi.h
@@ -10,25 +10,25 @@
#include "response.h"
-/** @brief Analyses non-post part of request from environment.
+/** Analyses non-post part of request from environment.
* @return 1 if ok, 0 if error. */
int magi_request_cgi_head(magi_request *request);
-/** @brief Complete request with post body from standard input.
+/** Complete request with post body from standard input.
* @return 1 if ok, 0 if error. */
int magi_request_cgi_body(magi_request *request);
-/** @brief Shortcut for analysing both head and body of request.
+/** Shortcut for analysing both head and body of request.
* @return 1 if ok, 0 if error. */
int magi_request_cgi(magi_request *request);
-/** @brief Sends response to standard output and destroys it.
+/** Sends response to standard output and destroys it.
* @return 1 if ok, 0 if error. */
int magi_response_cgi(magi_response *response);
-/** @brief Sends a standard response of Bad Request error.
+/** Sends a standard response of Bad Request error.
* @return 1 if ok, 0 if error. */
int magi_error_cgi(magi_error error);
diff --git a/include/magi/cookie.h b/include/magi/cookie.h
index e6a5c4f..8a92a82 100644
--- a/include/magi/cookie.h
+++ b/include/magi/cookie.h
@@ -7,31 +7,30 @@
*/
-/** @brief HTTP Cookie. */
+/** HTTP Cookie. */
typedef struct magi_cookie {
- char *name; /**<@brief Cookie name. */
- char *data; /**<@brief Cookie value. */
- char *path; /**<@brief Path on wich cookie is set.
+ char *name; /**< Cookie name. */
+ char *data; /**< Cookie value. */
+ char *path; /**< Path on wich cookie is set.
* Without '/' at the end. */
- char *domain; /**<@brief Domain in wich cookie is set.
+ char *domain; /**< Domain in wich cookie is set.
* With dot at the begining. */
- char *max_age; /**<@brief In seconds until discard (response only). */
+ char *max_age; /**< In seconds until discard (response only). */
} magi_cookie;
-/** @ brief HTTP cookies collection.
- *
+/** HTTP cookies collection.
* Implemented as a linked list. */
typedef struct magi_cookies {
- struct magi_cookies *next; /**<@brief Pointer to next cookies. */
- magi_cookie item; /**<@brief Cookie on top. */
+ struct magi_cookies *next; /**< Pointer to next cookies. */
+ magi_cookie item; /**< Cookie on top. */
} magi_cookies;
-/** @brief Add @p newitem to @p cookies.
+/** Add @p newitem to @p cookies.
* @param[in,out] cookies to add into.
* @param[in] newitem to add onto top of @p cookies. */
void magi_cookies_add(magi_cookies **cookies, magi_cookie *newitem);
-/** @brief Get data of cookie from @p cookies with @p name.
+/** Get data of cookie from @p cookies with @p name.
* @note Cookies in @p cookies are in reverse request order, and first cookie
* from request is the most accurate in terms of domain and path.
* @param[in] params to search in.
@@ -40,7 +39,7 @@ void magi_cookies_add(magi_cookies **cookies, magi_cookie *newitem);
* null only if no such parameter. */
char *magi_cookies_get(magi_cookies *cookies, const char *name);
-/** @brief Free memory used by @p cookies.
+/** Free memory used by @p cookies.
* @param[in,out] cookies to be destructed. */
void magi_cookies_free(magi_cookies *cookies);
diff --git a/include/magi/file.h b/include/magi/file.h
index 474913d..07baadc 100644
--- a/include/magi/file.h
+++ b/include/magi/file.h
@@ -6,35 +6,34 @@
#include "param.h"
-/** @brief Form field of file with its parameters. */
+/** Form field of file with its parameters. */
typedef struct magi_file {
- char *field; /**<@brief Name of form field. */
- char *filename; /**<@brief File name on user's computer. */
- magi_params *params; /**<@brief Multipart params (e.g. type). */
+ char *field; /**< Name of form field. */
+ char *filename; /**< File name on user's computer. */
+ magi_params *params; /**< Multipart params (e.g. type). */
} magi_file;
-/** @brief Form files collection.
- *
+/** Form files collection.
* Implemented as a linked list. */
typedef struct magi_files {
- struct magi_files *next; /**<@brief Pointer to next files. */
- magi_file item; /**<@brief File on top. */
+ struct magi_files *next; /**< Pointer to next files. */
+ magi_file item; /**< File on top. */
} magi_files;
-/** @brief Add @p newitem to @p files.
+/** Add @p newitem to @p files.
* @param[in,out] files to add into.
* @param[in] newitem to add onto top of @p files. */
void magi_files_add(magi_files **files, magi_file *newitem);
-/** @brief Get file with @p name from @p files.
+/** Get file with @p name from @p files.
* @param[in] files to search in.
* @param[in] name of needed file.
* @return first from top of @p files file with @p name,
- null only if no such file. */
+ * null only if no such file. */
magi_file *magi_files_get(magi_files *files, const char *name);
-/** @brief Free memory used by @p files.
+/** Free memory used by @p files.
* @param[in,out] files to be destructed. */
void magi_files_free(magi_files *files);
diff --git a/include/magi/loadfile.h b/include/magi/loadfile.h
index 41622d8..04e5c2c 100644
--- a/include/magi/loadfile.h
+++ b/include/magi/loadfile.h
@@ -13,25 +13,23 @@
#include "request.h"
-/** @brief Rule of loading single file.
- *
+/** Rule of loading single file.
* There is no need to form or edit it directly. */
typedef struct magi_loadfile {
- const char *name; /**<@brief Form field to load file from. */
- const char *path; /**<@brief Path to load file in. */
- int max; /**<@brief Limit in bytes. Null means unlimited. */
+ const char *name; /**< Form field to load file from. */
+ const char *path; /**< Path to load file in. */
+ int max; /**< Limit in bytes. Null means unlimited. */
} magi_loadfile;
-/** @brief Table of rules for loading files.
- *
+/** Table of rules for loading files.
* Set @c count and @c files as null to initialize. */
typedef struct magi_loadfiles {
- int count; /**<@brief Size of @c files.*/
- magi_loadfile *files; /**<@brief Dynamic array of rules to load files. */
+ int count; /**< Size of @c files.*/
+ magi_loadfile *files; /**< Dynamic array of rules to load files. */
} magi_loadfiles;
-/** @brief Add entity into @p table.
+/** Add entity into @p table.
* @param[in,out] table is the table to add into.
* @param[in] name is the form field name to load file from.
* @param[in] path to load file in.
@@ -41,12 +39,12 @@ void magi_loadfiles_add(magi_loadfiles *table,
const char *path,
int max);
-/** @brief Free memmory used by @p table.
+/** Free memmory used by @p table.
* @warning Request using @p table will become invalid.
* @param[in,out] table to be destructed. */
void magi_loadfiles_free(magi_loadfiles *table);
-/** @brief Setup @p request to use loadfiles callback with @p table.
+/** Setup @p request to use loadfiles callback with @p table.
* @param[in,out] request to setup using loadfiles callback.
* @param[in] table to use in loadfiles callback. */
void magi_loadfiles_set(magi_request *request, magi_loadfiles *table);
diff --git a/include/magi/param.h b/include/magi/param.h
index 7e1262b..0ad1919 100644
--- a/include/magi/param.h
+++ b/include/magi/param.h
@@ -5,34 +5,33 @@
*/
-/** @brief Parameter as name-value pair. */
+/** Parameter as name-value pair. */
typedef struct magi_param {
- char *name; /**<@brief Cannot be null. */
- char *data; /**<@brief Cannot be null. */
+ char *name; /**< Cannot be null. */
+ char *data; /**< Cannot be null. */
} magi_param;
-/** @brief Parameters collection.
- *
+/** Parameters collection.
* Implemented as a linked list. */
typedef struct magi_params {
- struct magi_params *next; /**<@brief Pointer to next parameters. */
- magi_param item; /**<@brief Parameter on top. */
+ struct magi_params *next; /**< Pointer to next parameters. */
+ magi_param item; /**< Parameter on top. */
} magi_params;
-/** @brief Add @p newitem to @p params.
+/** Add @p newitem to @p params.
* @param[in,out] params to add into.
* @param[in] newitem to add onto top of @p params. */
void magi_params_add(magi_params **params, magi_param *newitem);
-/** @brief Get data of parameter from @p params with @p name.
+/** Get data of parameter from @p params with @p name.
* @param[in] params to search in.
* @param[in] name of needed parameter.
* @return data of the first from top of @p params parameter with @p name,
* null only if no such parameter. */
char *magi_params_get(magi_params *params, const char *name);
-/** @brief Free memory used by @p params.
+/** Free memory used by @p params.
* @param[in,out] params to be destructed. */
void magi_params_free(magi_params *params);
diff --git a/include/magi/request.h b/include/magi/request.h
index 47acb27..0be32dc 100644
--- a/include/magi/request.h
+++ b/include/magi/request.h
@@ -11,82 +11,69 @@
#include "param.h"
+typedef struct magi_request_meta {
+ char *uri; /**< REQUEST_URI */
+ char *document_root; /**< DOCUMENT_ROOT */
+ char *document_uri; /**< DOCUMENT_URI */
+ char *script_name; /**< SCRIPT_NAME */
+ char *script_filename; /**< SCRIPT_FILENAME */
+ char *remote_addr; /**< REMOTE_ADDR */
+ char *remote_port; /**< REMOTE_PORT */
+ char *addr; /**< SERVER_ADDR */
+ char *name; /**< SERVER_NAME */
+ char *port; /**< SERVER_PORT */
+ char *protocol; /**< SERVER_PROTOCOL */
+ char *software; /**< SERVER_COFTWARE */
+} magi_request_meta;
+
+typedef struct magi_request_config {
+} magi_request_config;
+
+typedef struct magi_request_response {
+} magi_request_response;
+
+typedef struct magi_request_methods {
+} magi_request_methods;
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /**
- * @brief Request
+ * Request and response handler.
*
* Can be created via 'magi_request_{gateway interface name}', but will have
* nullified 'post'-related fields ('params' & 'files'). Reason is unlimited
* 'post' body size, with possible dependence of wanted limits from data of
* headers (e.g. session id from cookies, enabling some users to load more).
* To proceed 'post' use 'magi_request_resume_{gateway interface name}',
- * specifying settings if necessary.
- *
- *
- * Cheatsheet on environment:
- *
- * Request URL: http[s]://{server_name}[:{server_port}]{uri}
- * example.com 80
- * uri: {document_uri}[?{urlencode(url_params)}]
- * alfar=9973&veles=on
- * document_uri: {script_name}{path_info}
- * /bin/script /article/magic
- */
+ * specifying settings if necessary. */
typedef struct magi_request {
- /* * * Results * * */
- /* All pointers of this section must be valid as 'free' arguments. */
-
- /* Parsed */
- magi_cookie_list *cookies;
- magi_param_list *http_params; /* HTTP Header parameters */
- magi_param_list *url_params; /* Paramteres from URL */
- magi_param_list *params; /* Parameters from 'post' body */
- magi_file_list *files; /* 'Post' multipart files */
-
- /* Environment Shortcuts */
- char *method; /* REQUEST_METHOD */
- char *uri; /* REQUEST_URI */
- char *document_root; /* DOCUMENT_ROOT */
- char *document_uri; /* DOCUMENT_URI */
- char *script_name; /* SCRIPT_NAME */
- char *script_filename; /* SCRIPT_FILENAME */
- char *remote_addr; /* REMOTE_ADDR */
- char *remote_port; /* REMOTE_PORT */
- char *server_addr; /* SERVER_ADDR */
- char *server_name; /* SERVER_NAME */
- char *server_port; /* SERVER_PORT */
- char *server_protocol; /* SERVER_PROTOCOL */
- char *server_software; /* SERVER_COFTWARE */
- char *path_info; /* PATH_INFO */
-
- /* Request Error Code */
- magi_error error;
+ magi_cookies *cookies;
+ magi_params *params_head; /**< Paramteres from URL */
+ magi_params *params_body; /**< Parameters from 'post' body */
+ magi_files *files; /**< 'Post' multipart files */
+ magi_request_meta meta;
+ char *method; /**< REQUEST_METHOD */
+ char *path; /**< PATH_INFO */
+ int is_https;
+ magi_error error;
- /* * * Settings * * */
+ magi_request_config config;
+ magi_request_response response;
+ magi_request_methods *methods;
+} magi_request;
- /* Callback for processing files */
- void (*file_callback)(magi_file *file,
- char *addon,
- int addon_len,
- int is_addon_last,
- void *userdata);
- void *file_callback_userdata;
- int file_callback_addon_max;
- /* Limits for memory used (null <=> unlimitted) */
- int cookies_max;
- int url_params_max;
- int http_params_max;
- int params_max;
-} magi_request;
+void magi_request_init(magi_request *request);
+void magi_request_free(magi_request *request);
-/* Setup request with default settings. */
-void magi_request_setup(magi_request *request);
+char *magi_request_param(magi_request *request, const char *name);
+char *magi_request_param_url(magi_request *request, const char *name);
+magi_file *magi_request_file(magi_request *request, const char *name);
-/* Destroys request. */
-void magi_request_destroy(magi_request *request);
+char *magi_request_cookie(magi_request *request, const char *name);
+magi_cookie *magi_request_cookie_complex(magi_request *request,
+ const char *name);
#endif
diff --git a/include/magi/response.h b/include/magi/response.h
index 18f4b63..bee2e2c 100644
--- a/include/magi/response.h
+++ b/include/magi/response.h
@@ -1,47 +1,31 @@
#ifndef MAGI_INCLUDED_RESPONSE
#define MAGI_INCLUDED_RESPONSE
/** @file response.h
- * @brief General response functionality.
+ * @brief General response functionality for magi_request.
*
- * blah-blah-blah
+ * There are two parts of response, namely header and body.
+ * You can directly dive into filling the body, since default headers are set.
+ * Defult content-type is XHTML, status is 200 (Ok).
+ *
+ * @warning Use body related functions only after dealing with headers.
+ * (Since storing possibly large body in memory is a bad idea,
+ * all headers should be sent before anything from the body.)
*/
-/* TODO: rewrite in such way, that only headers are in memory. */
-#include "cookie.h"
-#include "param.h"
-
-
-typedef struct magi_response {
- magi_cookie_list *cookies;
- magi_param_list *http_params;
- char *content_type;
- char *content;
- int len;
- int size;
-} magi_response;
-
-
-void magi_response_setup(magi_response *response);
-
-
-void magi_response_content_type(magi_response *response, const char *type);
-
-void magi_response_add(magi_response *response, const char *addon);
-
-void magi_response_cookie(magi_response *response, magi_cookie *cookie);
-void magi_response_cookie_easy(magi_response *response,
- const char *name,
- const char *value);
-void magi_response_cookie_discard(magi_response *response,
- const char *name);
+void magi_response_status(magi_request *r, magi_status code);
+void magi_response_status_custom(magi_request *r, int code, const char *desc);
-void magi_response_http(magi_response *response,
- const char *name,
- const char *data);
+void magi_response_cookie(magi_request *r, const char *name, const char *data);
+void magi_response_cookie_complex(magi_request *r, magi_cookie *c);
+void magi_response_cookie_discard(magi_request *r, const char *name);
+void magi_response_content_length(magi_request *r, int length);
+void magi_response_content_type(magi_request *r, const char *type);
-void magi_response_destroy(magi_response *response);
+void magi_response(magi_request *r, const char *addon);
+void magi_response_format(magi_request *r, const char *format, ...);
+void magi_response_file(magi_request *r, FILE *file);
#endif
diff --git a/include/magi/urlenc.h b/include/magi/urlenc.h
index 99f7bbe..0eff58b 100644
--- a/include/magi/urlenc.h
+++ b/include/magi/urlenc.h
@@ -15,12 +15,12 @@
*/
-/** @brief Count URL-code size for @p plain.
+/** Count URL-code size for @p plain.
* @param[in] plain is a text to count code size for.
* @return size of URL-code of @p plain. */
int magi_urlenc_size(const char *plain);
-/** @brief Encode @p plain to url-code @p code.
+/** Encode @p plain to url-code @p code.
* @warning @p code must be at least size of #magi_urlenc_size(@p plain).
* @param[in] plain is a text to be encoded.
* @param[out] code will be filled with URL-code of @p plain. */