a5e50bab64fdf0c9bdac0204e06cb639a03328df
[ashd.git] / lib / req.h
1 #ifndef _LIB_HTREQ_H
2 #define _LIB_HTREQ_H
3
4 #include <stdio.h>
5
6 struct hthead {
7     char *method, *url, *ver, *msg;
8     int code;
9     char *rest;
10     char ***headers;
11     int noheaders;
12 };
13
14 struct hthead *mkreq(char *method, char *url, char *ver);
15 struct hthead *mkresp(int code, char *msg, char *ver);
16 void freehthead(struct hthead *head);
17 char *getheader(struct hthead *head, char *name);
18 void headpreheader(struct hthead *head, const char *name, const char *val);
19 void headappheader(struct hthead *head, const char *name, const char *val);
20 int sendreq(int sock, struct hthead *req, int fd);
21 int recvreq(int sock, struct hthead **reqp);
22 void replrest(struct hthead *head, char *rest);
23 int parseheaders(struct hthead *head, FILE *in);
24 int writeresp(FILE *out, struct hthead *resp);
25 char *unquoteurl(char *in);
26
27 #endif