diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2020-03-20 23:06:46 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2020-03-20 23:06:46 +0300 |
commit | 8acbd33a82d2c13e70eb17447bc6abfd86cf9512 (patch) | |
tree | f89d1c6ec04e3ba418b63c37202d6abc4f08138e /include | |
parent | fcffb003f36a4357b6ba88e6b5e2239d7d111a6a (diff) | |
download | magi-8acbd33a82d2c13e70eb17447bc6abfd86cf9512.tar magi-8acbd33a82d2c13e70eb17447bc6abfd86cf9512.tar.xz magi-8acbd33a82d2c13e70eb17447bc6abfd86cf9512.zip |
[magi]
Diffstat (limited to 'include')
-rw-r--r-- | include/magi.h | 2 | ||||
-rw-r--r-- | include/magi/cookie.h | 3 | ||||
-rw-r--r-- | include/magi/fastcgi.h | 7 | ||||
-rw-r--r-- | include/magi/file.h | 2 | ||||
-rw-r--r-- | include/magi/loadfiles.h (renamed from include/magi/loadfile.h) | 0 | ||||
-rw-r--r-- | include/magi/param.h | 2 | ||||
-rw-r--r-- | include/magi/request.h | 13 | ||||
-rw-r--r-- | include/magi/response.h | 2 | ||||
-rw-r--r-- | include/magi/session.h | 17 |
9 files changed, 35 insertions, 13 deletions
diff --git a/include/magi.h b/include/magi.h index a5b047d..d8e1245 100644 --- a/include/magi.h +++ b/include/magi.h @@ -8,7 +8,7 @@ #include "magi/error.h" #include "magi/fastcgi.h" #include "magi/file.h" -#include "magi/loadfile.h" +#include "magi/loadfiles.h" #include "magi/param.h" #include "magi/request.h" #include "magi/response.h" diff --git a/include/magi/cookie.h b/include/magi/cookie.h index 96e4273..4760b75 100644 --- a/include/magi/cookie.h +++ b/include/magi/cookie.h @@ -30,7 +30,8 @@ void magi_cookies_add(magi_cookies **cookies, magi_cookie *newitem); /* Get last from top of cookies cookie with name, null if no such cookie. * Cookies are in reversed request order, and first cookie from request is * the most accurate in terms of domain and path. */ -magi_cookie *magi_cookies_get(magi_cookies *cookies, const char *name); +const magi_cookie *magi_cookies_get(const magi_cookies *cookies, + const char *name); #endif diff --git a/include/magi/fastcgi.h b/include/magi/fastcgi.h index fb1f2e5..3d91b7b 100644 --- a/include/magi/fastcgi.h +++ b/include/magi/fastcgi.h @@ -2,10 +2,13 @@ #define MAGI_INCLUDED_FASTCGI /* Fast CGI implementation */ -/* * * TODO * * */ +#include "session.h" +#include "request.h" -enum { magi_to_avoid_warning }; +int magi_fastcgi_head(magi_session *s, magi_request *r); +int magi_fastcgi_body(magi_session *s, magi_request *r); +int magi_fastcgi(magi_session *s, magi_request *r); #endif diff --git a/include/magi/file.h b/include/magi/file.h index d4c5e98..cd3d675 100644 --- a/include/magi/file.h +++ b/include/magi/file.h @@ -25,7 +25,7 @@ void magi_files_free(magi_files *files); void magi_files_add(magi_files **files, magi_file *newitem); /* Get first from top of files file with name, null if no such file. */ -magi_file *magi_files_get(magi_files *files, const char *name); +const magi_file *magi_files_get(const magi_files *files, const char *name); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * diff --git a/include/magi/loadfile.h b/include/magi/loadfiles.h index bf3421c..bf3421c 100644 --- a/include/magi/loadfile.h +++ b/include/magi/loadfiles.h diff --git a/include/magi/param.h b/include/magi/param.h index 589db9f..c0879a9 100644 --- a/include/magi/param.h +++ b/include/magi/param.h @@ -29,7 +29,7 @@ void magi_params_set(magi_params **params, magi_param *newitem); /* Get data of the first from top of params parameter with name, * null if no such parameter. */ -char *magi_params_get(magi_params *params, const char *name); +char *magi_params_get(const magi_params *params, const char *name); #endif diff --git a/include/magi/request.h b/include/magi/request.h index 3d0d48a..7245feb 100644 --- a/include/magi/request.h +++ b/include/magi/request.h @@ -60,20 +60,21 @@ void magi_request_free(magi_request *r); /* Get value of meta-param with name. */ -char *magi_request_meta(magi_request *r, const char *name); +char *magi_request_meta(const magi_request *r, const char *name); /* Get value of form field param (prioritising body) with name. */ -char *magi_request_param(magi_request *r, const char *name); +char *magi_request_param(const magi_request *r, const char *name); /* Get value of form field param with name from url. */ -char *magi_request_urlparam(magi_request *r, const char *name); +char *magi_request_urlparam(const magi_request *r, const char *name); /* Get metadata structure of file from file field with name. */ -magi_file *magi_request_file(magi_request *r, const char *name); +const magi_file *magi_request_file(const magi_request *r, const char *name); /* Get value of cookie with name. */ -char *magi_request_cookie(magi_request *r, const char *name); +char *magi_request_cookie(const magi_request *r, const char *name); /* Get cookie with name. */ -magi_cookie *magi_request_cookie_complex(magi_request *r, const char *name); +const magi_cookie *magi_request_cookie_complex(const magi_request *r, + const char *name); #endif diff --git a/include/magi/response.h b/include/magi/response.h index 4b71ef5..11acf75 100644 --- a/include/magi/response.h +++ b/include/magi/response.h @@ -4,7 +4,7 @@ * * 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). + * Defult content-type is HTML, status is 200 (OK). * * Use body related functions only after dealing with headers. * (Since storing possibly large body in memory is a bad idea, diff --git a/include/magi/session.h b/include/magi/session.h new file mode 100644 index 0000000..c1c5903 --- /dev/null +++ b/include/magi/session.h @@ -0,0 +1,17 @@ +#ifndef MAGI_INCLUDED_SESSION +#define MAGI_INCLUDED_SESSION + + +typedef struct magi_session { + int socket; +} magi_session; + + +void magi_session_init(magi_session *s); +void magi_session_free(magi_session *s); + +int magi_session_inet(magi_session *s, const char *address, int port); +int magi_session_unix(magi_session *s, const char *path); + + +#endif |