diff --git a/Makefile b/Makefile index eea2c5e..48378be 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +VERSION=$(shell head -n 1 CHANGES | tr -d :) + CFLAGS += -Os -fomit-frame-pointer #CFLAGS=-g @@ -26,13 +28,13 @@ str_len.o str_diff.o str_chr.o str_diffn.o str_start.o scan_ulong.o -ranlib $@ httpd.o: httpd.c - $(CC) -pipe $(CFLAGS) -c $^ -DFNORD=\"fnord/$(shell head -n 1 CHANGES|sed 's/://')\" + $(CC) -pipe $(CFLAGS) -c $^ -DFNORD=\"fnord/$(VERSION)\" httpd-cgi.o: httpd.c - $(CC) -pipe $(CFLAGS) -c httpd.c -o $@ -DCGI -DFNORD=\"fnord/$(shell head -n 1 CHANGES|sed 's/://')\" + $(CC) -pipe $(CFLAGS) -c httpd.c -o $@ -DCGI -DFNORD=\"fnord/$(VERSION)\" httpd-idx.o: httpd.c - $(CC) -pipe $(CFLAGS) -c httpd.c -o $@ -DDIR_LIST -DFNORD=\"fnord/$(shell head -n 1 CHANGES|sed 's/://')\" + $(CC) -pipe $(CFLAGS) -c httpd.c -o $@ -DDIR_LIST -DFNORD=\"fnord/$(VERSION)\" %.o: %.c $(CC) -pipe $(CFLAGS) -c $^ @@ -48,10 +50,9 @@ install: test -d /command || mkdir /command CURNAME=$(notdir $(shell pwd)) -VERSION=fnord-$(shell head -n 1 CHANGES|sed 's/://') tar: rename - cd .. && tar cvvf $(VERSION).tar.bz2 --use=bzip2 --exclude CVS --exclude bin-* --exclude .cvsignore --exclude default $(VERSION) + cd .. && tar cvvf fnord-$(VERSION).tar.bz2 --use=bzip2 --exclude CVS --exclude bin-* --exclude .cvsignore --exclude default fnord-$(VERSION) rename: - if test $(CURNAME) != $(VERSION); then cd .. && mv $(CURNAME) $(VERSION); fi + if test $(CURNAME) != fnord-$(VERSION); then cd .. && mv $(CURNAME) fnord-$(VERSION); fi diff --git a/httpd.c b/httpd.c index 2c84e98..4b978e1 100644 --- a/httpd.c +++ b/httpd.c @@ -266,10 +266,14 @@ static void badrequest(long code,const char *httpcomment,const char *message) { buffer_putulong(buffer_1,code); buffer_putspace(buffer_1); buffer_puts(buffer_1,httpcomment); - buffer_puts(buffer_1, "\r\nConnection: close\r\n\r\n"); + buffer_puts(buffer_1, "\r\nConnection: close\r\n"); if (message[0]) { - buffer_puts(buffer_1,"\r\nContent-Type: text/html"); + buffer_puts(buffer_1,"Content-Length: "); + buffer_putulong(buffer_1,strlen(message)); + buffer_puts(buffer_1,"\r\nContent-Type: text/html\r\n\r\n"); buffer_puts(buffer_1,message); + } else { + buffer_puts(buffer_1,"\r\n"); } buffer_flush(buffer_1); exit(0);