1 |
rakinar2 |
44 |
#ifndef FREEHTTPD_REQUEST_H |
2 |
|
|
#define FREEHTTPD_REQUEST_H |
3 |
|
|
|
4 |
|
|
#include "freehttpd.h" |
5 |
|
|
#include <stdbool.h> |
6 |
|
|
#include <stddef.h> |
7 |
|
|
|
8 |
|
|
typedef struct freehttpd_header |
9 |
|
|
{ |
10 |
|
|
char *name; |
11 |
|
|
char *value; |
12 |
rakinar2 |
45 |
size_t name_length; |
13 |
|
|
size_t value_length; |
14 |
rakinar2 |
44 |
} freehttpd_header_t; |
15 |
|
|
|
16 |
|
|
typedef struct freehttpd_request |
17 |
|
|
{ |
18 |
|
|
char *method; |
19 |
|
|
size_t method_length; |
20 |
|
|
char *uri; |
21 |
|
|
size_t uri_length; |
22 |
rakinar2 |
45 |
char *path; |
23 |
|
|
size_t path_length; |
24 |
|
|
char *query; |
25 |
|
|
size_t query_length; |
26 |
rakinar2 |
44 |
char *version; |
27 |
|
|
size_t version_length; |
28 |
|
|
freehttpd_header_t **headers; |
29 |
|
|
size_t headers_count; |
30 |
|
|
char *body; |
31 |
|
|
size_t body_length; |
32 |
|
|
} freehttpd_request_t; |
33 |
|
|
|
34 |
|
|
freehttpd_request_t *freehttpd_request_init (const char *method, |
35 |
|
|
const char *uri, |
36 |
|
|
const char *version); |
37 |
|
|
void freehttpd_request_free (freehttpd_request_t *request); |
38 |
|
|
freehttpd_request_t *freehttpd_request_parse (freehttpd_t *freehttpd, |
39 |
|
|
int sockfd, ecode_t *error); |
40 |
|
|
|
41 |
rakinar2 |
45 |
freehttpd_header_t *freehttpd_header_init (const char *name, const char *value, |
42 |
|
|
size_t name_length, |
43 |
|
|
size_t value_length); |
44 |
|
|
void freehttpd_header_free (freehttpd_header_t *header); |
45 |
|
|
|
46 |
rakinar2 |
44 |
#endif |