1
0
mirror of https://github.com/lxsang/ant-http synced 2024-07-03 13:39:46 +02:00
ant-http/http_server.h

49 lines
1.4 KiB
C
Raw Normal View History

2017-07-30 01:00:36 +02:00
#ifndef HTTP_SERVER
#define HTTP_SERVER
2015-10-22 11:39:11 +02:00
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/stat.h>
#include <pthread.h>
#include <signal.h>
2017-07-29 22:00:34 +02:00
#include <sys/socket.h>
2018-02-09 13:13:11 +01:00
#include "libs/handle.h"
2015-10-22 11:39:11 +02:00
#include "plugin_manager.h"
2017-07-29 22:00:34 +02:00
#define FORM_URL_ENCODE "application/x-www-form-urlencoded"
#define FORM_MULTI_PART "multipart/form-data"
#define APP_JSON "application/json"
#define PLUGIN_HANDLER "handler"
#define WS_MAGIC_STRING "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
2015-10-22 11:39:11 +02:00
#define ISspace(x) isspace((int)(x))
2017-07-29 23:54:43 +02:00
#define SERVER_STRING "Server: ant-httpd"
2015-10-22 11:39:11 +02:00
2018-02-10 11:22:41 +01:00
#define CONFIG "config.ini"
extern config_t server_config;
void accept_request(void*);
void cat(void*, FILE *);
void cannot_execute(void*);
2015-10-22 11:39:11 +02:00
void error_die(const char *);
int get_line(int, char *, int);
2018-02-10 11:22:41 +01:00
void not_found(void*);
void serve_file(void*, const char *);
2015-10-22 11:39:11 +02:00
int startup(unsigned *);
2018-02-10 11:22:41 +01:00
void unimplemented(void*);
void badrequest(void*);
void rule_check(association, const char* , const char* , const char* , char*);
2018-02-10 11:22:41 +01:00
void ws_confirm_request(void*, const char*);
char* post_url_decode(void* client,int len);
2017-07-29 22:00:34 +02:00
dictionary decode_url_request(const char* query);
2018-02-10 11:22:41 +01:00
dictionary decode_request(void* client,const char* method, char* url);
dictionary decode_multi_part_request(void*,const char*);
2017-07-29 22:00:34 +02:00
dictionary decode_cookie(const char*);
2018-02-10 11:22:41 +01:00
char* json_data_decode(void*,int);
2017-07-29 22:00:34 +02:00
2018-02-10 11:22:41 +01:00
int execute_plugin(void* client, const char *path,
const char *method, dictionary rq);
2017-07-30 01:00:36 +02:00
#endif