1 |
/* $Id: tw_http.h 140 2024-09-23 11:31:18Z nishi $ */ |
2 |
|
3 |
#ifndef __TW_HTTP_H__ |
4 |
#define __TW_HTTP_H__ |
5 |
|
6 |
#ifdef __cplusplus |
7 |
extern "C" { |
8 |
#endif |
9 |
|
10 |
#include <stdbool.h> |
11 |
|
12 |
#include "../config.h" |
13 |
|
14 |
struct tw_http_request { |
15 |
char* method; |
16 |
char* path; |
17 |
char* query; |
18 |
char* version; |
19 |
char** headers; |
20 |
char* body; |
21 |
}; |
22 |
|
23 |
struct tw_http_response { |
24 |
char** headers; |
25 |
int status; |
26 |
bool _processed; /* Internal parameter */ |
27 |
}; |
28 |
|
29 |
#ifdef SOURCE |
30 |
#ifndef NO_SSL |
31 |
#include <openssl/ssl.h> |
32 |
#endif |
33 |
void tw_free_request(struct tw_http_request* req); |
34 |
#ifndef NO_SSL |
35 |
int tw_http_parse(SSL* ssl, int sock, struct tw_http_request* req); |
36 |
#else |
37 |
int tw_http_parse(void* ssl, int sock, struct tw_http_request* req); |
38 |
#endif |
39 |
#endif |
40 |
|
41 |
#ifdef __cplusplus |
42 |
} |
43 |
#endif |
44 |
|
45 |
#endif |