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 CGI_H
30 #define CGI_H
31
32 #include "../public/nsapi.h"
33 #include "../../ucx/buffer.h"
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 typedef struct {
40 int in[
2];
41 int out[
2];
42 pid_t pid;
43 } CGIProcess;
44
45 typedef struct {
46 Session *sn;
47 Request *rq;
48 UcxBuffer *tmp;
49 int status;
50 char *msg;
51 } CGIResponseParser;
52
53 int send_cgi(pblock *pb, Session *sn, Request *rq);
54
55 char** cgi_add_vars(
char **env, Session *sn, Request *rq);
56
57 int cgi_start(CGIProcess *p,
char *path,
char *
const argv[],
char *
const envp[]);
58
59 int cgi_close(CGIProcess *p);
60
61 CGIResponseParser* cgi_parser_new(Session *sn, Request *rq);
62 void cgi_parser_free(CGIResponseParser *parser);
63 int cgi_parse_response(CGIResponseParser *parser,
char *buf,
size_t len,
size_t *bpos);
64
65 #ifdef __cplusplus
66 }
67 #endif
68
69 #endif
70
71