forked from riolet/WAFer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnope.h
45 lines (34 loc) · 857 Bytes
/
nope.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
41
42
43
44
45
#ifndef NOPE_H_
#define NOPE_H_
/* Define boolean */
typedef int bool;
#define true 1
#define false 0
#define SERVER_STRING "Server: nope.chttpd/0.1.0\r\n"
#define ToHex(Y) (Y>='0'&&Y<='9'?Y-'0':Y-'A'+10)
#define UNDEFINED "VALUE_UNDEFINED"
/* Settings */
#define MAX_HEADERS 1024
#define MAX_BUFFER_SIZE 1024
#define MAX_DPRINTF_SIZE 64
#define MAX_FD_SIZE 1024
#define MAX_METHOD_SIZE 64
#define MAX_VER_SIZE 64
#define MAX_REQUEST_SIZE 8192
/* Define HTTP request parsing states */
#define STATE_PRE_REQUEST 0
#define STATE_METHOD 1
#define STATE_URI 2
#define STATE_VERSION 3
#define STATE_HEADER 4
#define STATE_COMPLETE_READING 5
#define STATUS_HTTP_OK 200
typedef struct struct_request {
int client;
char * reqStr;
char * method;
char **headers;
} Request;
void freeHeaders(char **);
void server(Request request);
#endif /* NOPE_H_ */