fix non-200 response code pages

This commit is contained in:
Neale Pickett 2011-10-19 15:18:16 -06:00
parent bec43822ba
commit ca73f41f75
2 changed files with 13 additions and 8 deletions

View File

@ -1,3 +1,5 @@
VERSION=$(shell head -n 1 CHANGES | tr -d :)
CFLAGS += -Os -fomit-frame-pointer CFLAGS += -Os -fomit-frame-pointer
#CFLAGS=-g #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 $@ -ranlib $@
httpd.o: httpd.c 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 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 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 %.o: %.c
$(CC) -pipe $(CFLAGS) -c $^ $(CC) -pipe $(CFLAGS) -c $^
@ -48,10 +50,9 @@ install:
test -d /command || mkdir /command test -d /command || mkdir /command
CURNAME=$(notdir $(shell pwd)) CURNAME=$(notdir $(shell pwd))
VERSION=fnord-$(shell head -n 1 CHANGES|sed 's/://')
tar: rename 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: rename:
if test $(CURNAME) != $(VERSION); then cd .. && mv $(CURNAME) $(VERSION); fi if test $(CURNAME) != fnord-$(VERSION); then cd .. && mv $(CURNAME) fnord-$(VERSION); fi

View File

@ -266,10 +266,14 @@ static void badrequest(long code,const char *httpcomment,const char *message) {
buffer_putulong(buffer_1,code); buffer_putulong(buffer_1,code);
buffer_putspace(buffer_1); buffer_putspace(buffer_1);
buffer_puts(buffer_1,httpcomment); 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]) { 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); buffer_puts(buffer_1,message);
} else {
buffer_puts(buffer_1,"\r\n");
} }
buffer_flush(buffer_1); buffer_flush(buffer_1);
exit(0); exit(0);