X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fhtparser.c;h=4325e975a9cb22f537439dfde0f05c3e8060bd97;hb=18fb436dba91930a8d60c1d343c50b55b55a4c37;hp=c8064f23fc0ae9d649052815e817aa3beeb02d46;hpb=15fa3fe85e9f499003defd7134bfeaa65d3959e2;p=ashd.git diff --git a/src/htparser.c b/src/htparser.c index c8064f2..4325e97 100644 --- a/src/htparser.c +++ b/src/htparser.c @@ -276,7 +276,10 @@ void serve(FILE *in, struct conn *conn) if(!strcmp(req->ver, "HTTP/1.0")) { writeresp(in, resp); fprintf(in, "\r\n"); - if((hd = getheader(resp, "content-length")) != NULL) { + if(!strcasecmp(req->method, "head")) { + if(!hasheader(req, "connection", "keep-alive")) + break; + } else if((hd = getheader(resp, "content-length")) != NULL) { dlen = passdata(out, in, -1); if(dlen != atoo(hd)) break; @@ -289,7 +292,10 @@ void serve(FILE *in, struct conn *conn) if(hasheader(req, "connection", "close") || hasheader(resp, "connection", "close")) break; } else if(!strcmp(req->ver, "HTTP/1.1")) { - if((hd = getheader(resp, "content-length")) != NULL) { + if(!strcasecmp(req->method, "head")) { + writeresp(in, resp); + fprintf(in, "\r\n"); + } else if((hd = getheader(resp, "content-length")) != NULL) { writeresp(in, resp); fprintf(in, "\r\n"); dlen = passdata(out, in, -1); @@ -454,7 +460,7 @@ int main(int argc, char **argv) usage(stderr); exit(1); } - if((plex = stdmkchild(argv + ++i)) < 0) { + if((plex = stdmkchild(argv + ++i, NULL, NULL)) < 0) { flog(LOG_ERR, "could not spawn root multiplexer: %s", strerror(errno)); return(1); }