Merge branch 'master' into duplex
[ashd.git] / lib / req.h
... / ...
CommitLineData
1#ifndef _LIB_HTREQ_H
2#define _LIB_HTREQ_H
3
4#include <stdio.h>
5
6struct bufio;
7
8struct hthead {
9 char *method, *url, *ver, *msg;
10 int code;
11 char *rest;
12 char ***headers;
13 int noheaders;
14};
15
16struct hthead *mkreq(char *method, char *url, char *ver);
17struct hthead *mkresp(int code, char *msg, char *ver);
18void freehthead(struct hthead *head);
19char *getheader(struct hthead *head, char *name);
20void headpreheader(struct hthead *head, const char *name, const char *val);
21void headappheader(struct hthead *head, const char *name, const char *val);
22void headrmheader(struct hthead *head, const char *name);
23int sendreq2(int sock, struct hthead *req, int fd, int flags);
24int sendreq(int sock, struct hthead *req, int fd);
25int recvreq(int sock, struct hthead **reqp);
26void replrest(struct hthead *head, char *rest);
27int parseheaders(struct hthead *head, FILE *in);
28int parseheadersb(struct hthead *head, struct bufio *in);
29struct hthead *parseresponse(FILE *in);
30struct hthead *parseresponseb(struct bufio *in);
31int writeresp(FILE *out, struct hthead *resp);
32int writerespb(struct bufio *out, struct hthead *resp);
33char *unquoteurl(char *in);
34
35#endif