Merge branch 'master' into timeheap
[ashd.git] / lib / req.h
CommitLineData
33733396
FT
1#ifndef _LIB_HTREQ_H
2#define _LIB_HTREQ_H
3
5fc1bf9f
FT
4#include <stdio.h>
5
e7bdd59a
FT
6struct bufio;
7
41213112
FT
8struct hthead {
9 char *method, *url, *ver, *msg;
10 int code;
11 char *rest;
33733396
FT
12 char ***headers;
13 int noheaders;
14};
15
41213112
FT
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);
f89ce57a 22void headrmheader(struct hthead *head, const char *name);
d9f67fea 23int sendreq2(int sock, struct hthead *req, int fd, int flags);
af34331c 24int sendreq(int sock, struct hthead *req, int fd);
41213112 25int recvreq(int sock, struct hthead **reqp);
9e9eca79 26void replrest(struct hthead *head, char *rest);
5fc1bf9f 27int parseheaders(struct hthead *head, FILE *in);
e7bdd59a 28int parseheadersb(struct hthead *head, struct bufio *in);
3ef78895 29struct hthead *parseresponse(FILE *in);
e7bdd59a 30struct hthead *parseresponseb(struct bufio *in);
5fc1bf9f 31int writeresp(FILE *out, struct hthead *resp);
e7bdd59a 32int writerespb(struct bufio *out, struct hthead *resp);
1604c096 33char *unquoteurl(char *in);
33733396
FT
34
35#endif