X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=lib%2Freq.c;h=a3e727390948601f8300e63cda1e7a20c7e4e346;hb=470938bdc9149ae9c7befd0cd983f46fcc056192;hp=b3d92140d4f0ce3e153eea58abbe1ea57d50c6fd;hpb=a39d9e16527a796bdf15bf4bb8fab81aac24ffa1;p=ashd.git diff --git a/lib/req.c b/lib/req.c index b3d9214..a3e7273 100644 --- a/lib/req.c +++ b/lib/req.c @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef HAVE_CONFIG_H #include @@ -191,6 +192,21 @@ void headappheader(struct hthead *head, const char *name, const char *val) head->headers[i][1] = sstrdup(val); } +void headrmheader(struct hthead *head, const char *name) +{ + int i; + + for(i = 0; i < head->noheaders; i++) { + if(!strcasecmp(head->headers[i][0], name)) { + free(head->headers[i][0]); + free(head->headers[i][1]); + free(head->headers[i]); + memmove(head->headers + i, head->headers + i + 1, sizeof(head->headers) * (--head->noheaders - i)); + return; + } + } +} + int writeresp(FILE *out, struct hthead *resp) { int i; @@ -239,6 +255,7 @@ int recvreq(int sock, struct hthead **reqp) if((fd = recvfd(sock, &buf.b, &buf.d)) < 0) { return(-1); } + fcntl(fd, F_SETFD, FD_CLOEXEC); buf.s = buf.d; p = buf.b; l = buf.d;