jf-framework
Loading...
Searching...
No Matches
http.h
Go to the documentation of this file.
1
6
7
#ifndef JF_FRAMEWORK_HTTP_H
8
#define JF_FRAMEWORK_HTTP_H
9
10
#include <stddef.h>
11
#include <stdint.h>
12
13
// https://www.rfc-editor.org/info/rfc2616/
14
typedef
struct
{
15
char
method[8];
16
char
path[256];
17
char
version[16];
18
char
query[256];
19
char
host[256];
20
char
contentType[128];
21
size_t
contentLength;
22
struct
{
23
char
name[64];
24
char
value[256];
25
} headers[32];
26
uint32_t headerCount;
27
const
char
* body;
28
size_t
bodyLength;
29
struct
{
30
char
key[32];
31
char
value[128];
32
} params[32];
33
uint32_t paramCount;
34
}
HttpRequest
;
35
36
typedef
struct
{
37
uint32_t response;
38
char
reason[64];
39
char
contentType[128];
40
size_t
contentLength;
41
struct
{
42
char
name[64];
43
char
value[256];
44
} headers[32];
45
uint32_t headerCount;
46
char
* body;
47
size_t
bodyCapacity;
48
}
HttpResponse
;
49
50
uint32_t
jf_ParseHttpRequest
(
HttpRequest
* httpRequest,
const
char
* buffer,
size_t
length);
51
52
#endif
jf_ParseHttpRequest
uint32_t jf_ParseHttpRequest(HttpRequest *httpRequest, const char *buffer, size_t length)
Parses the HTTP request.
Definition
http.c:24
HttpRequest
Definition
http.h:14
HttpResponse
Definition
http.h:36
include
http.h
Generated by
1.16.1