| 1 | #ifndef _LIB_HTREQ_H |
| 2 | #define _LIB_HTREQ_H |
| 3 | |
| 4 | struct hthead { |
| 5 | char *method, *url, *ver, *msg; |
| 6 | int code; |
| 7 | char *rest; |
| 8 | char ***headers; |
| 9 | int noheaders; |
| 10 | }; |
| 11 | |
| 12 | struct hthead *mkreq(char *method, char *url, char *ver); |
| 13 | struct hthead *mkresp(int code, char *msg, char *ver); |
| 14 | void freehthead(struct hthead *head); |
| 15 | char *getheader(struct hthead *head, char *name); |
| 16 | void headpreheader(struct hthead *head, const char *name, const char *val); |
| 17 | void headappheader(struct hthead *head, const char *name, const char *val); |
| 18 | int sendreq(int sock, struct hthead *req, int fd); |
| 19 | int recvreq(int sock, struct hthead **reqp); |
| 20 | void replrest(struct hthead *head, char *rest); |
| 21 | |
| 22 | #endif |