forked from tinylcy/vino
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tinyhttpd.h
40 lines (30 loc) · 915 Bytes
/
tinyhttpd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#define DYNAMIC_PATH "cgi-bin"
#define PORT "PORT"
#define THREAD_NUM "THREAD_NUM"
#define JOB_MAX_NUM "JOB_MAX_NUM"
#include "http_headers_parser.h"
#include "http_request.h"
/* store the configuration params */
struct httpd_conf {
int port;
int thread_num;
int job_max_num;
};
int make_server_socket_q(int, int);
int make_server_socket(int);
int connect_to_server(char*, int);
int make_socket_non_blocking(int);
void init_conf(struct httpd_conf*);
void process_request(void *req_ptr);
void http_response(http_request_t *request);
void header(FILE*, char*);
char *file_type(char*);
void not_implement(int);
void do_404(char*, int);
void do_ls(char*, int);
void serve_static(char *, int);
void serve_dynamic(http_request_headers_t*, int);
void serve_get_dynamic(http_request_headers_t*, int);
void serve_post_dynamic(http_request_headers_t*, int);
void sanitize(char*);
int is_dynamic(const char*);