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;
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);