first working but buggy version

This commit is contained in:
lxsang
2018-10-04 19:47:31 +02:00
parent 3447b07fc6
commit 5477f54f60
5 changed files with 272 additions and 382 deletions

View File

@ -300,8 +300,41 @@ void clear_cookie(void* client, dictionary dic)
}
void unknow(void* client)
{
html(client);
__t(client,"404 API not found");
set_status(client,520,"Unknown Error");
__t(client,"Content-Type: text/html; charset=utf-8");
response(client,"");
__t(client,"520 Unknow request");
}
void notfound(void* client)
{
set_status(client,404,"Not found");
__t(client,"Content-Type: text/html; charset=utf-8");
response(client,"");
__t(client,"Resource not found");
}
void badrequest(void* client)
{
set_status(client,400,"Bad request");
__t(client,"Content-Type: text/html; charset=utf-8");
response(client,"");
__t(client,"400 Bad request");
}
void unimplemented(void* client)
{
set_status(client,501,"Method Not Implemented");
__t(client,"Content-Type: text/html");
response(client,"");
__t(client, "<HTML><HEAD><TITLE>Method Not Implemented");
__t(client, "</TITLE></HEAD>");
__t(client, "<BODY><P>HTTP request method not supported.");
__t(client, "</BODY></HTML>");
}
void cannot_execute(void* client)
{
set_status(client,500,"Internal Server Error");
__t(client,"Content-Type: text/html");
response(client,"");
__t(client, "<P>Error prohibited CGI execution.");
}
int ws_enable(dictionary dic)
{

View File

@ -80,6 +80,9 @@ void set_status(void*,int,const char*);
void clear_cookie(void*, dictionary);
/*Default function for plugin*/
void unknow(void*);
void badrequest(void* client);
void unimplemented(void* client);
void notfound(void* client);
int ws_enable(dictionary);
char* read_line(void* sock);
int read_buf(void* sock,char* buf,int i);