#ifndef CGI_H
#define CGI_H
#include "../public/nsapi.h"
#include "../../ucx/buffer.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int in[
2];
int out[
2];
pid_t pid;
} CGIProcess;
typedef struct {
Session *sn;
Request *rq;
UcxBuffer *tmp;
int status;
char *msg;
} CGIResponseParser;
int send_cgi(pblock *pb, Session *sn, Request *rq);
char** cgi_add_vars(
char **env, Session *sn, Request *rq);
int cgi_start(CGIProcess *p,
char *path,
char *
const argv[],
char *
const envp[]);
int cgi_close(CGIProcess *p);
CGIResponseParser* cgi_parser_new(Session *sn, Request *rq);
void cgi_parser_free(CGIResponseParser *parser);
int cgi_parse_response(CGIResponseParser *parser,
char *buf,
size_t len,
size_t *bpos);
#ifdef __cplusplus
}
#endif
#endif