1
0
mirror of https://github.com/lxsang/ant-http synced 2024-07-01 12:59:47 +02:00

support json cookie

This commit is contained in:
root 2016-11-01 00:20:23 +00:00
parent bd8ed530b9
commit 5ebe581ea3
4 changed files with 5 additions and 5 deletions

Binary file not shown.

View File

@ -18,7 +18,7 @@ void execute(int client,const char* method,dictionary rq)
dictionary d = dict();
dput(d,"test",c);
dput(d,"test1","This is another cookie");
set_cookie(client,d);
set_cookie(client,"text/html; charset=utf-8",d);
LOG("%s",c);
__t(client,"<h1>Set the cookie</h1>");

View File

@ -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");

View File

@ -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);