diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2020-07-18 08:29:10 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2020-07-18 08:29:10 +0300 |
commit | 43968691c2a7f1f95cf7476fc8ab3c0bba8bab54 (patch) | |
tree | ddd2d851508a2b93ce95d3d65b272620bc5322f6 /src | |
parent | 36dda991898ce621a0b0f7103f763690e73fa0ff (diff) | |
download | magi-43968691c2a7f1f95cf7476fc8ab3c0bba8bab54.tar magi-43968691c2a7f1f95cf7476fc8ab3c0bba8bab54.tar.xz magi-43968691c2a7f1f95cf7476fc8ab3c0bba8bab54.zip |
Removed unnecessary field meta from request.
Diffstat (limited to 'src')
-rw-r--r-- | src/parse.c | 25 | ||||
-rw-r--r-- | src/request.c | 9 |
2 files changed, 0 insertions, 34 deletions
diff --git a/src/parse.c b/src/parse.c index 0ca1cd9..390900f 100644 --- a/src/parse.c +++ b/src/parse.c @@ -15,8 +15,6 @@ #include <stdlib.h> #include <string.h> -extern char **const environ; - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * CGI Request @@ -37,30 +35,8 @@ static char *lower_env(char *env_name) return env; } -static void cgi_http_env(struct magi_request *r) -{ - char **env; - int len = 0; - r->meta = 0; - for (env = environ; *env; ++env) { - struct magi_param meta; - char *name_end = strchr(*env, '='); - int nlen = name_end - *env; - int dlen = strlen(name_end + 1); - len += nlen + dlen; - if (len > r->limits.params_meta && r->limits.params_meta) { - r->error = magi_error_limit; - return; - } - meta.name = magi_str_create_copy(*env, nlen); - meta.data = magi_str_create_copy(name_end + 1, dlen); - magi_params_add(&r->meta, &meta); - } -} - static void cgi_env(struct magi_request *r) { - cgi_http_env(r); r->method = plain_env("REQUEST_METHOD"); r->document_root = plain_env("DOCUMENT_ROOT"); r->script = plain_env("SCRIPT_NAME"); @@ -179,7 +155,6 @@ int magi_parse_head(struct magi_request *request) { request->cookies = 0; request->files = 0; - request->meta = 0; request->head = 0; request->body = 0; request->error = 0; diff --git a/src/request.c b/src/request.c index d401e67..fd13f74 100644 --- a/src/request.c +++ b/src/request.c @@ -10,7 +10,6 @@ void magi_request_init(struct magi_request *request) request->callback.userdata = 0; request->callback.addon_max = 1024; request->limits.cookies = 0; - request->limits.params_meta = 0; request->limits.params_head = 0; request->limits.params_body = 0; request->limits.read_buffer = 65536; @@ -21,7 +20,6 @@ void magi_request_init(struct magi_request *request) static void request_free(struct magi_request *request) { free(request->cookies); - free(request->meta); free(request->head); free(request->body); free(request->files); @@ -35,7 +33,6 @@ static void request_free(struct magi_request *request) static void request_annul(struct magi_request *request) { request->cookies = 0; - request->meta = 0; request->head = 0; request->body = 0; request->files = 0; @@ -49,7 +46,6 @@ void magi_request_free(struct magi_request *request) { if (request) { magi_cookies_free(request->cookies); - magi_params_free(request->meta); magi_params_free(request->head); magi_params_free(request->body); magi_files_free(request->files); @@ -59,11 +55,6 @@ void magi_request_free(struct magi_request *request) } -char *magi_request_meta(const struct magi_request *r, const char *name) -{ - return magi_params_get(r->meta, name); -} - char *magi_request_param(const struct magi_request *r, const char *name) { char *res = magi_params_get(r->body, name); |