mirror of
https://github.com/lxsang/ant-http
synced 2025-07-15 05:19:55 +02:00
first working but buggy version
This commit is contained in:
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user