HEAD

Nikola Vladov <[email protected]> 27 Mar 2006 10:00:39 -0000
Newsgroups gmane.comp.web.fnord
Message-ID <[email protected]>
Hi, people!

I have two patches for fnord.  The are not security patches :-)))

After HEAD fnord return 1 and closes connection.  I changed this with
(see label closedir):

...
	  int zero=0;
	  setsockopt(1,IPPROTO_TCP,TCP_CORK,&zero,sizeof(zero));
	}
#endif
      closedir:
	if (keepalive>0) {
	  close(fd);
	  fchdir(rootdir); close(rootdir);
	  goto handlenext;
	}
#endif
	exit(0);
error500:
	retcode=500;
      } else {
	buffer_flush(buffer_1);
	goto closedir;
      }
    }
...

The socond patch is to put in logs exactly the served bytes 
(see dolog() function bellow)

...
      fd2=doit(buf,len,fnord,0);
      if (fd2>=0) {	/* yeah! */
	url=fnord;
	close(fd);
	fd=fd2;
      } else {
	encoding=oldencoding;
	if (trypng) mimetype=oldmimetype;
      }
      retcode=200;
      if (method==HEAD) dolog(0);
      else dolog(rangeend-rangestart);
...


Enjoy,  Nikola