From 5ebe581ea395954379a5ce4aec7473fcb104ac92 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 1 Nov 2016 00:20:23 +0000 Subject: [PATCH] support json cookie --- ._Makefile | Bin 4096 -> 4096 bytes plugins/cookiex/cookiex.c | 2 +- plugins/plugin.c | 6 +++--- plugins/plugin.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/._Makefile b/._Makefile index c2055de8b241f02b1a092085a3aa83add42e1def..f3106e70f28f9324d38aa3bca2fa83efc153583a 100644 GIT binary patch delta 28 kcmZorXi%7t&d4z_!Set the cookie"); diff --git a/plugins/plugin.c b/plugins/plugin.c index 0da0039..662856f 100644 --- a/plugins/plugin.c +++ b/plugins/plugin.c @@ -237,17 +237,17 @@ int upload(const char* tmp, const char* path) { return !rename(tmp, path); } -void set_cookie(int client,dictionary dic) +void set_cookie(int client,const char* type, dictionary dic) { header_base(client); - __t(client,"Content-Type: text/html; charset=utf-8"); + __t(client,"Content-Type: %s",type); association assoc; for_each_assoc(assoc,dic){ __t(client,"Set-Cookie: %s=%s",assoc->key, (char*)assoc->value); } response(client,""); } -void clear_cookie(int client, dictionary dic) +void clear_cookie(int client, dictionary dic) { header_base(client); __t(client,"Content-Type: text/html; charset=utf-8"); diff --git a/plugins/plugin.h b/plugins/plugin.h index 1366de3..f977101 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -57,7 +57,7 @@ char* htdocs(const char*); sqldb getdb(); sqldb __getdb(char *name); #endif -void set_cookie(int,dictionary); +void set_cookie(int, const char*,dictionary); void clear_cookie(int, dictionary); /*Default function for plugin*/ void handler(int, const char*,const char*,dictionary);