Commit | Line | Data |
---|---|---|
33733396 FT |
1 | #ifndef _LIB_HTREQ_H |
2 | #define _LIB_HTREQ_H | |
3 | ||
5fc1bf9f FT |
4 | #include <stdio.h> |
5 | ||
41213112 FT |
6 | struct hthead { |
7 | char *method, *url, *ver, *msg; | |
8 | int code; | |
9 | char *rest; | |
33733396 FT |
10 | char ***headers; |
11 | int noheaders; | |
12 | }; | |
13 | ||
41213112 FT |
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); | |
f89ce57a | 20 | void headrmheader(struct hthead *head, const char *name); |
d9f67fea | 21 | int sendreq2(int sock, struct hthead *req, int fd, int flags); |
af34331c | 22 | int sendreq(int sock, struct hthead *req, int fd); |
41213112 | 23 | int recvreq(int sock, struct hthead **reqp); |
9e9eca79 | 24 | void replrest(struct hthead *head, char *rest); |
5fc1bf9f | 25 | int parseheaders(struct hthead *head, FILE *in); |
3ef78895 | 26 | struct hthead *parseresponse(FILE *in); |
5fc1bf9f | 27 | int writeresp(FILE *out, struct hthead *resp); |
1604c096 | 28 | char *unquoteurl(char *in); |
33733396 FT |
29 | |
30 | #endif |