aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/magi.h4
-rw-r--r--include/magi/request.h86
-rw-r--r--include/magi/response.h1
3 files changed, 43 insertions, 48 deletions
diff --git a/include/magi.h b/include/magi.h
index c14f8b6..0089878 100644
--- a/include/magi.h
+++ b/include/magi.h
@@ -1,8 +1,6 @@
#ifndef MAGI_INCLUDED_EVERYTHING
#define MAGI_INCLUDED_EVERYTHING
-/** @file magi.h
- * @brief All headers are included here.
- *
+/* All headers are included here.
* You can include this, if you don't want to think about headers.
*/
#include "magi/cgi.h"
diff --git a/include/magi/request.h b/include/magi/request.h
index 0be32dc..4e04989 100644
--- a/include/magi/request.h
+++ b/include/magi/request.h
@@ -10,30 +10,19 @@
#include "file.h"
#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;
+typedef void (*magi_file_callback_act)(void *, magi_file *, char *, int);
+typedef struct magi_file_callback {
+ magi_file_callback_act act;
+ void *userdata;
+ int addon_max;
+} magi_file_callback;
+
+typedef struct magi_request_limits {
+ int cookies;
+ int params_http;
+ int params_head;
+ int params_body;
+} magi_request_limits;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /**
* Request and response handler.
@@ -45,35 +34,42 @@ typedef struct magi_request_methods {
* To proceed 'post' use 'magi_request_resume_{gateway interface name}',
* specifying settings if necessary. */
typedef struct magi_request {
+ 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;
-
- magi_request_config config;
- magi_request_response response;
- magi_request_methods *methods;
+ magi_params *meta;
+ magi_params *head;
+ magi_params *body;
+ magi_files *files;
+
+ magi_method method;
+ int is_secure;
+ char *domain;
+ int port;
+ char *script;
+ char *path;
+
+ magi_file_callback callback;
+ magi_request_limits limits;
+
+ struct magi_response_implementation *response;
} magi_request;
-void magi_request_init(magi_request *request);
-void magi_request_free(magi_request *request);
+void magi_request_init(magi_request *r);
+void magi_request_free(magi_request *r);
+
+char *magi_request_meta(magi_request *r, magi_meta code);
+char *magi_request_meta_custom(magi_request *r, const char *name);
-char *magi_request_param(magi_request *request, const char *name);
-char *magi_request_param_url(magi_request *request, const char *name);
+char *magi_request_param(magi_request *r, const char *name);
+char *magi_request_urlparam(magi_request *r, const char *name);
-magi_file *magi_request_file(magi_request *request, const char *name);
+magi_file *magi_request_file(magi_request *r, const char *name);
-char *magi_request_cookie(magi_request *request, const char *name);
-magi_cookie *magi_request_cookie_complex(magi_request *request,
- const char *name);
+char *magi_request_cookie(magi_request *r, const char *name);
+magi_cookie *magi_request_cookie_complex(magi_request *r, const char *name);
#endif
diff --git a/include/magi/response.h b/include/magi/response.h
index bee2e2c..a623da1 100644
--- a/include/magi/response.h
+++ b/include/magi/response.h
@@ -11,6 +11,7 @@
* (Since storing possibly large body in memory is a bad idea,
* all headers should be sent before anything from the body.)
*/
+#include "request.h"
void magi_response_status(magi_request *r, magi_status code);