X-Git-Url: http://www.dolda2000.com/gitweb/?a=blobdiff_plain;f=lib%2Freq.h;h=9ae60ab4ef1a568bde61bc47b6d04d346b65767f;hb=7d1e14f405f389656604c68e18a381feabcd3d4a;hp=b68dff05772a01cb319a593b11f3636c11f0ece4;hpb=66987955eb1903d6d21d21471f145cbd1f514520;p=ashd.git diff --git a/lib/req.h b/lib/req.h index b68dff0..9ae60ab 100644 --- a/lib/req.h +++ b/lib/req.h @@ -1,17 +1,35 @@ #ifndef _LIB_HTREQ_H #define _LIB_HTREQ_H -struct htreq { - char *method, *url, *ver; - char *restbuf, *rest; +#include + +struct bufio; + +struct hthead { + char *method, *url, *ver, *msg; + int code; + char *rest; char ***headers; int noheaders; }; -struct htreq *mkreq(char *method, char *url, char *ver); -void freereq(struct htreq *req); -char *getheader(struct htreq *req, char *name); -void reqpreheader(struct htreq *req, char *name, char *val); -void reqappheader(struct htreq *req, char *name, char *val); +struct hthead *mkreq(char *method, char *url, char *ver); +struct hthead *mkresp(int code, char *msg, char *ver); +void freehthead(struct hthead *head); +char *getheader(struct hthead *head, char *name); +void headpreheader(struct hthead *head, const char *name, const char *val); +void headappheader(struct hthead *head, const char *name, const char *val); +void headrmheader(struct hthead *head, const char *name); +int sendreq2(int sock, struct hthead *req, int fd, int flags); +int sendreq(int sock, struct hthead *req, int fd); +int recvreq(int sock, struct hthead **reqp); +void replrest(struct hthead *head, char *rest); +int parseheaders(struct hthead *head, FILE *in); +int parseheadersb(struct hthead *head, struct bufio *in); +struct hthead *parseresponse(FILE *in); +struct hthead *parseresponseb(struct bufio *in); +int writeresp(FILE *out, struct hthead *resp); +int writerespb(struct bufio *out, struct hthead *resp); +char *unquoteurl(char *in); #endif