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 #ifndef PROTOCOL_H
30 #define PROTOCOL_H
31
32 #include "../public/nsapi.h"
33 #include "../util/io.h"
34 #include <sys/uio.h>
35 #include "../util/strbuf.h"
36 #include <cx/buffer.h>
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 void protocol_status(Session *sn, Request *rq,
int n,
const char *m);
43 const char* protocol_status_message(
int code);
44
45 void add_http_status_line(CxBuffer *out,
pool_handle_t *pool, Request *rq);
46 void add_http_response_header(CxBuffer *out, Request *rq);
47
48 int http_start_response(Session *sn, Request *rq);
49
50 int http_send_continue(Session *sn);
51
52 int request_header(
char *name,
char **value, Session *sn, Request *rq);
53
54 void http_get_scheme_host_port(
55 Session *sn,
56 Request *rq,
57 char **scheme,
58 char **host,
59 uint16_t *port);
60
61 #define sbuf_write(out, buf, len) sbuf_append(out, cx_strn(buf, len))
62
63 #ifdef __cplusplus
64 }
65 #endif
66
67 #endif
68
69