diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2020-02-06 11:33:59 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2020-02-06 11:33:59 +0300 |
commit | 37cd01d27efc7988548dbfde307e41be7d4f41a9 (patch) | |
tree | 55a461e17772ae6f43a9148d095c62c920d6b501 /src | |
parent | fca83975899b01c62ede4258f175346b7039be3d (diff) | |
download | magi-37cd01d27efc7988548dbfde307e41be7d4f41a9.tar magi-37cd01d27efc7988548dbfde307e41be7d4f41a9.tar.xz magi-37cd01d27efc7988548dbfde307e41be7d4f41a9.zip |
[magi]
Diffstat (limited to 'src')
-rw-r--r-- | src/cgi.c | 5 | ||||
-rw-r--r-- | src/response.c | 16 |
2 files changed, 9 insertions, 12 deletions
@@ -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 <ctype.h> #include <stdio.h> #include <stdlib.h> 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)); |