From 37cd01d27efc7988548dbfde307e41be7d4f41a9 Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Thu, 6 Feb 2020 11:33:59 +0300 Subject: [magi] --- src/cgi.c | 5 +++-- src/response.c | 16 ++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/cgi.c b/src/cgi.c index 32b5b4d..c3ac1c6 100644 --- a/src/cgi.c +++ b/src/cgi.c @@ -3,11 +3,12 @@ #include "cookie.h" #include "error.h" #include "file.h" +#include "inner_cookies.h" #include "inner_tools.h" -#include "multipart.h" +#include "inner_multipart.h" +#include "inner_urlencoded.h" #include "param.h" #include "request.h" -#include "urlenc.h" #include #include #include diff --git a/src/response.c b/src/response.c index fdeba34..9570cd1 100644 --- a/src/response.c +++ b/src/response.c @@ -23,7 +23,6 @@ void magi_response_setup(magi_response *response) void magi_response_content_type(magi_response *response, const char *type) { -<<<<<<< HEAD static const char *const ct = "Content-Type: "; static const int ctlen = 15; const int len = strlen(type); @@ -31,15 +30,6 @@ void magi_response_content_type(magi_response *response, const char *type) response->content_type = malloc(ctlen + len + 1); memcpy(response->content_type, ct, ctlen); memcpy(response->content_type + ctlen, type, len + 1); -======= - const char * const messages[] = { - "Content-Type: application/xhtml+xml", /* magi_xhtml */ - }; - if (!response->content_type) { - response->content_type = magi_str_create_copy(messages[type], - strlen(messages[type])); - } ->>>>>>> master } void magi_response_add(magi_response *r, const char *addon) @@ -83,6 +73,11 @@ void magi_response_cookie_easy(magi_response *response, const char *name, const char *value) { + magi_cookie cookie = { 0, 0, 0, 0, 0 }; + cookie.name = magi_str_create_copy(name, strlen(name)); + cookie.data = magi_str_create_copy(value, strlen(value)); + magi_cookie_list_add(&response->cookies, &cookie); +} void magi_response_cookie_discard(magi_response *response, const char *name) { @@ -95,6 +90,7 @@ void magi_response_cookie_discard(magi_response *response, const char *name) void magi_response_http(magi_response *response, const char *name, + const char *data) { magi_param param = { 0, 0 }; param.name = magi_str_create_copy(name, strlen(name)); -- cgit v1.2.3