-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttp.h
More file actions
38 lines (31 loc) · 691 Bytes
/
Copy pathhttp.h
File metadata and controls
38 lines (31 loc) · 691 Bytes
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
#ifndef HTTP_H
#define HTTP_H
typedef struct {
char *key;
char *value;
} HttpHeader;
typedef struct {
char *method;
char *path;
char *version;
HttpHeader *headers;
int header_count;
char *body;
} HttpRequest;
typedef struct {
char *version;
char *status_desc;
char *body;
long body_length;
int status_code;
HttpHeader *headers;
int header_count;
} HttpResponse;
/**
* Parses the data until the blank line is encountered, i.e. the request line
* and all the headers.
*/
int parse_headers(const char *data, HttpRequest* req);
HttpHeader* get_header(HttpRequest request, char* key);
char* resptostr(HttpResponse resp);
#endif