Commit | Line | Data |
---|---|---|
33733396 FT |
1 | #ifndef _LIB_HTREQ_H |
2 | #define _LIB_HTREQ_H | |
3 | ||
5fc1bf9f FT |
4 | #include <stdio.h> |
5 | ||
e7bdd59a FT |
6 | struct bufio; |
7 | ||
41213112 FT |
8 | struct 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 |
16 | struct hthead *mkreq(char *method, char *url, char *ver); |
17 | struct hthead *mkresp(int code, char *msg, char *ver); | |
18 | void freehthead(struct hthead *head); | |
19 | char *getheader(struct hthead *head, char *name); | |
20 | void headpreheader(struct hthead *head, const char *name, const char *val); | |
21 | void headappheader(struct hthead *head, const char *name, const char *val); | |
f89ce57a | 22 | void headrmheader(struct hthead *head, const char *name); |
d9f67fea | 23 | int sendreq2(int sock, struct hthead *req, int fd, int flags); |
af34331c | 24 | int sendreq(int sock, struct hthead *req, int fd); |
41213112 | 25 | int recvreq(int sock, struct hthead **reqp); |
9e9eca79 | 26 | void replrest(struct hthead *head, char *rest); |
5fc1bf9f | 27 | int parseheaders(struct hthead *head, FILE *in); |
e7bdd59a | 28 | int parseheadersb(struct hthead *head, struct bufio *in); |
3ef78895 | 29 | struct hthead *parseresponse(FILE *in); |
e7bdd59a | 30 | struct hthead *parseresponseb(struct bufio *in); |
5fc1bf9f | 31 | int writeresp(FILE *out, struct hthead *resp); |
e7bdd59a | 32 | int writerespb(struct bufio *out, struct hthead *resp); |
1604c096 | 33 | char *unquoteurl(char *in); |
33733396 FT |
34 | |
35 | #endif |