Index: .depend
===================================================================
RCS file: /home/jon/cvs/boa/src/.depend,v
retrieving revision 1.6
diff -r1.6 .depend
1,16c1,16
< alias.o: alias.c boa.h defines.h globals.h compat.h config.h
< boa.o: boa.c boa.h defines.h globals.h compat.h config.h
< cgi.o: cgi.c boa.h defines.h globals.h compat.h config.h
< config.o: config.c boa.h defines.h globals.h compat.h config.h
< get.o: get.c boa.h defines.h globals.h compat.h config.h
< hash.o: hash.c boa.h defines.h globals.h compat.h config.h
< log.o: log.c boa.h defines.h globals.h compat.h config.h
< queue.o: queue.c boa.h defines.h globals.h compat.h config.h
< read.o: read.c boa.h defines.h globals.h compat.h config.h
< request.o: request.c boa.h defines.h globals.h compat.h config.h
< response.o: response.c boa.h defines.h globals.h compat.h config.h
< signals.o: signals.c boa.h defines.h globals.h compat.h config.h
< util.o: util.c boa.h defines.h globals.h compat.h config.h escape.h
< cgi_header.o: cgi_header.c boa.h defines.h globals.h compat.h config.h
< pipe.o: pipe.c boa.h defines.h globals.h compat.h config.h
< mmap_cache.o: mmap_cache.c boa.h defines.h globals.h compat.h config.h
---
> alias.o: alias.c boa.h compat.h config.h defines.h globals.h
> boa.o: boa.c boa.h compat.h config.h defines.h globals.h
> cgi.o: cgi.c boa.h compat.h config.h defines.h globals.h
> config.o: config.c boa.h compat.h config.h defines.h globals.h
> get.o: get.c boa.h compat.h config.h defines.h globals.h
> hash.o: hash.c boa.h compat.h config.h defines.h globals.h
> log.o: log.c boa.h compat.h config.h defines.h globals.h
> queue.o: queue.c boa.h compat.h config.h defines.h globals.h
> read.o: read.c boa.h compat.h config.h defines.h globals.h
> request.o: request.c boa.h compat.h config.h defines.h globals.h
> response.o: response.c boa.h compat.h config.h defines.h globals.h
> signals.o: signals.c boa.h compat.h config.h defines.h globals.h
> util.o: util.c boa.h compat.h config.h defines.h globals.h escape.h
> cgi_header.o: cgi_header.c boa.h compat.h config.h defines.h globals.h
> pipe.o: pipe.c boa.h compat.h config.h defines.h globals.h
> mmap_cache.o: mmap_cache.c boa.h compat.h config.h defines.h globals.h
Index: Changelog
===================================================================
RCS file: /home/jon/cvs/boa/src/Changelog,v
retrieving revision 1.2
diff -r1.2 Changelog
0a1,15
> ** Changes for the 0.93 version **
>  * Huge quantities of changes
>  * keepalive Bugfix in 0.93.16.2 by Jon Nelson
>    report by Craig Silverstein of Google fame.
>    (Craig Silverstein <csilvers@google.com>)
>  * patch for config.h by Craig Silverstein <csilvers@google.com>
>  * fixed "Parent Directory" problem in boa_indexer for title "/"
>    (Debian bug #36165)
>  * More Craig Silverstein <csilvers@google.com> modifications, namely:
>    ErrorLog        (if omitted, print to stderr)
>    DocumentRoot    (if omitted, can only server user-dir files)
>    DirectoryIndex  (if omitted, always use DirectoryMaker)
>    MimeTypes       (if omitted, don't load -- users can use AddType instead)
> 
> 
Index: alias.c
===================================================================
RCS file: /home/jon/cvs/boa/src/alias.c,v
retrieving revision 1.37
diff -r1.37 alias.c
200,202c200,205
< 			strcat(buffer, p);
< 	} else {					/* no aliasing, no userdir... */
< 		sprintf(buffer, "%s%s", document_root, req->request_uri);
---
> 		    strcat(buffer, p);
> 	} else if (document_root) {					/* no aliasing, no userdir... */
> 	    sprintf(buffer, "%s%s", document_root, req->request_uri);
> 	} else {					/* no document_root?  Can't serve pages */
> 	    send_r_not_found(req);
> 	    return 0;
Index: boa.c
===================================================================
RCS file: /home/jon/cvs/boa/src/boa.c,v
retrieving revision 1.60
diff -r1.60 boa.c
27d26
< #include <sys/time.h>			/* select */
Index: boa.h
===================================================================
RCS file: /home/jon/cvs/boa/src/boa.h,v
retrieving revision 1.30
diff -r1.30 boa.h
25a26
> #include "compat.h"				/* oh what fun is porting */
29a31
> #ifdef HAVE_FCNTL_H
30a33,34
> #endif
> #ifdef HAVE_LIMITS_H
31a36
> #endif
37a43
> #ifdef HAVE_UNISTD_H
38a45
> #endif
43,44d49
< #include "compat.h"				/* oh what fun is porting */
< 
151a157,162
> #ifndef HAVE_STRSTR
> char *strstr(char *s1, char *s2);
> #endif
> #ifndef HAVE_STRDUP
> char *strdup(char *s);
> #endif
Index: boa_grammar.y
===================================================================
RCS file: /home/jon/cvs/boa/src/boa_grammar.y,v
retrieving revision 1.11
diff -r1.11 boa_grammar.y
25a26
> #ifdef HAVE_UNISTD_H
26a28
> #endif
Index: boa_lexer.l
===================================================================
RCS file: /home/jon/cvs/boa/src/boa_lexer.l,v
retrieving revision 1.9
diff -r1.9 boa_lexer.l
24a25
> #ifdef HAVE_UNISTD_H
25a27
> #endif
87,88c89,92
< 	yyin = fopen(mime_types, "r");
< 	if(!yyin) {
---
>         /* if mime_types is not defined, fall through to done-reading case */
>         if ( mime_types ) {
>   	  yyin = fopen(mime_types, "r");
>   	  if(!yyin) {
94a99
>         }
Index: cgi.c
===================================================================
RCS file: /home/jon/cvs/boa/src/cgi.c,v
retrieving revision 1.45
diff -r1.45 cgi.c
62,63c62,63
<  * 
<  * Description: Allocates memory for environment before execing a CGI 
---
>  *
>  * Description: Allocates memory for environment before execing a CGI
130a131,132
> 	if ( value == NULL )          /* ServerAdmin may not be defined, eg */
> 	    return NULL;
144c146
< /* 
---
> /*
163c165
< /* 
---
> /*
165c167
<  * 
---
>  *
185c187
< /*      
---
> /*
234,235c236,237
<  * 
<  * Description: Called for GET/POST requests that refer to ScriptAlias 
---
>  *
>  * Description: Called for GET/POST requests that refer to ScriptAlias
239c241
<  * 
---
>  *
309,310c311,312
< 		/* Close access log, so CGI program can't scribble 
< 		 * where it shouldn't 
---
> 		/* Close access log, so CGI program can't scribble
> 		 * where it shouldn't
318,319c320,321
< 		/* 
< 		 * tie STDERR to cgi_log_fd 
---
> 		/*
> 		 * tie STDERR to cgi_log_fd
Index: compat.h
===================================================================
RCS file: /home/jon/cvs/boa/src/compat.h,v
retrieving revision 1.3
diff -r1.3 compat.h
24a25
> #ifdef HAVE_UNISTD_H
25a27
> #endif
45a48,54
> #endif
> 
> #ifdef TIME_WITH_SYS_TIME
> #ifdef TIME_WITH_SYS_TIME
> /* maybe-defined in config.h */
> #include <sys/time.h>
> #endif
Index: config.c
===================================================================
RCS file: /home/jon/cvs/boa/src/config.c,v
retrieving revision 1.11
diff -r1.11 config.c
73a74
> #ifdef HAVE_GETHOSTNAME
76c77,79
< 		if (!hostentbuf) {
---
> 		if (!hostentbuf)
> #endif
> 		{
Index: defines.h
===================================================================
RCS file: /home/jon/cvs/boa/src/defines.h,v
retrieving revision 1.60
diff -r1.60 defines.h
50a51
> #if defined HAVE_DIRENT_H
51a53,59
> #elif defined HAVE_NDIR_H
> #include <ndir.h>
> #elif defined HAVE_SYS_DIR_H
> #include <sys/dir.h>
> #elif defined HAVE_SYS_NDIR_H
> #include <sys/ndir.h>
> #endif
Index: get.c
===================================================================
RCS file: /home/jon/cvs/boa/src/get.c,v
retrieving revision 1.56
diff -r1.56 get.c
233,234c233,234
< 	char pathname_with_index[MAX_PATH_LENGTH];
< 	int data_fd;
---
>     char pathname_with_index[MAX_PATH_LENGTH];
>     int data_fd;
235a236
>     if (directory_index) { /* look for index.html first?? */
241,243c242,244
< 		strcpy(req->request_uri, directory_index);	/* for mimetype */
< 		fstat(data_fd, statbuf);
< 		return data_fd;
---
> 	    strcpy(req->request_uri, directory_index);	/* for mimetype */
> 	    fstat(data_fd, statbuf);
> 	    return data_fd;
246,247c247,248
< 		send_r_forbidden(req);
< 		return -1;
---
> 	    send_r_forbidden(req);
> 	    return -1;
253c254
< 		close(data_fd);
---
> 	    close(data_fd);
255,272c256,273
< 		req->response_status = R_REQUEST_OK;
< 		if (req->method == M_HEAD) {
< 			req_write(req, "HTTP/1.0 200 OK-GUNZIP\r\n");
< 			print_http_headers(req);
< 			print_last_modified(req);
< 			req_write(req, "Content-Type: ");
< 			req_write(req, get_mime_type(directory_index));
< 			req_write(req, "\r\n\r\n");
< 			req_flush(req);
< 			return 0;
< 		}
< 		if (req->pathname)
< 			free(req->pathname);
< 		req->pathname = strdup(pathname_with_index);
< 		if (init_cgi(req) == 0)
< 			return -1;
< 		return 0;				/* in this case, 0 means success */
< 	} else
---
> 	    req->response_status = R_REQUEST_OK;
> 	    if (req->method == M_HEAD) {
> 		req_write(req, "HTTP/1.0 200 OK-GUNZIP\r\n");
> 		print_http_headers(req);
> 		print_last_modified(req);
> 		req_write(req, "Content-Type: ");
> 		req_write(req, get_mime_type(directory_index));
> 		req_write(req, "\r\n\r\n");
> 		req_flush(req);
> 		return 0;
> 	    }
> 	    if (req->pathname)
> 		free(req->pathname);
> 	    req->pathname = strdup(pathname_with_index);
> 	    if (init_cgi(req) == 0)
> 		return -1;
> 	    return 0;				/* in this case, 0 means success */
> 	}
273a275
>     }
275,276c277,278
< 	if (dirmaker != NULL) {
< 		req->response_status = R_REQUEST_OK;
---
>     if (dirmaker != NULL) { /* don't look for index.html... maybe automake? */
> 	req->response_status = R_REQUEST_OK;
278,292c280,288
< 		/* the indexer should take care of all headers */
< 		if (!req->simple || req->method == M_HEAD) {
< 			req_write(req, "HTTP/1.0 200 OK\r\n");
< 			print_http_headers(req);
< 			print_last_modified(req);
< 			req_write(req, "Content-Type: ");
< 			req_write(req, get_mime_type(directory_index));
< 			req_write(req, "\r\n\r\n");
< 			req_flush(req);
< 		}
< 		if (req->method == M_HEAD)
< 			return 0;
< 
< 		return (init_cgi(req) == 0 ? -1 : 0);
< 		/* in this case, 0 means success */
---
> 	/* the indexer should take care of all headers */
> 	if (!req->simple || req->method == M_HEAD) {
> 	    req_write(req, "HTTP/1.0 200 OK\r\n");
> 	    print_http_headers(req);
> 	    print_last_modified(req);
> 	    req_write(req, "Content-Type: ");
> 	    req_write(req, get_mime_type(directory_index));
> 	    req_write(req, "\r\n\r\n");
> 	    req_flush(req);
293a290,295
> 	if (req->method == M_HEAD)
> 	    return 0;
> 
> 	return (init_cgi(req) == 0 ? -1 : 0);
> 	/* in this case, 0 means success */
>     } else { /* neither index.html nor autogenerate are allowed */
296c298,299
< }
---
>     }
> }
\ No newline at end of file
Index: index_dir.c
===================================================================
RCS file: /home/jon/cvs/boa/src/index_dir.c,v
retrieving revision 1.18
diff -r1.18 index_dir.c
147,149c147,152
< 		   "<h3>Directories</h3>\n<table>\n"
< 	"<tr><td colspan=3><a href=\"../\">Parent Directory</a></td></tr>\n",
< 		   title, title);
---
> 	       "<h3>Directories</h3>\n<table>\n%s",
> 	       title, title,
> 	       (strcmp(title, "/") == 0 ? "" :
> 		"<tr><td colspan=3><a href=\"../\">Parent Directory</a></td></tr>\n"
> 	       )
> 	      );
158c161,162
< 			continue;
---
> 		    continue;
> 
Index: log.c
===================================================================
RCS file: /home/jon/cvs/boa/src/log.c,v
retrieving revision 1.19
diff -r1.19 log.c
37,38c37,38
<  * 
<  * Description: Opens up the error log, ties it to stderr, and line 
---
>  *
>  * Description: Opens up the error log, ties it to stderr, and line
54a55,57
> #ifdef SETVBUF_REVERSED
> 		setvbuf(access_log, _IOLBF, (char *) NULL, 0);
> #else
55a59
> #endif
83,87c87,91
< 	if (!error_log_name) {
< 		fputs("No ErrorLog directive specified in boa.conf.\n", stderr);
< 		die(NO_OPEN_LOG);
< 	}
< 	if (!(error_log = fopen(error_log_name, "a")))
---
> 	/* if error_log_name is set, dup2 stderr to it */
> 	/* otherwise, leave stderr alone */
> 	if (error_log_name) {
> 	    /* open the log file */
> 	    if (!(error_log = fopen(error_log_name, "a")))
89,91c93,95
< 
< 	/* redirect stderr to error_log */
< 	if (dup2(fileno(error_log), STDERR_FILENO) == -1) {
---
> 	    
> 	    /* redirect stderr to error_log */
> 	    if (dup2(fileno(error_log), STDERR_FILENO) == -1) {
93a98,99
> 	    }
> 	    fclose(error_log);
94a101
> 
100d106
< 	fclose(error_log);
105c111
<  * 
---
>  *
116c122
<  * 
---
>  *
135c141
<  * Description: Logs the current time to the stderr (the error log): 
---
>  * Description: Logs the current time to the stderr (the error log):
150c156
<  * to the stderr (the error log): 
---
>  * to the stderr (the error log):
Index: response.c
===================================================================
RCS file: /home/jon/cvs/boa/src/response.c,v
retrieving revision 1.23
diff -r1.23 response.c
78c78
< 	if (req->keepalive == KA_ACTIVE) {
---
> 	if (req->keepalive == KA_ACTIVE && req->response_status < 400) {
Index: signals.c
===================================================================
RCS file: /home/jon/cvs/boa/src/signals.c,v
retrieving revision 1.18
diff -r1.18 signals.c
26a27
> #ifdef HAVE_SYS_WAIT_H
27a29
> #endif
Index: util.c
===================================================================
RCS file: /home/jon/cvs/boa/src/util.c,v
retrieving revision 1.31
diff -r1.31 util.c
44a45,81
>  * Name: strstr and strdup
>  *
>  * These are the standard library utilities.  We define them here for
>  * systems that don't have them.
>  */
> #ifndef HAVE_STRSTR
> char *strstr(char *s1, char *s2)        /* from libiberty */
> {
> 	register char *p;
> 	register int len = strlen(s2);
> 
> 	if ( *s2 == '\0' )              /* everything matches empty string */
> 		return s1;
> 	for (p = s1; (p = strchr(p, *s2)) != NULL; p = strchr(p+1, *s2)) {
> 		if (strncmp (p, s2, len) == 0)
> 			return (p);
> 	}
> 	return NULL;
> }
> #endif
> 
> #ifndef HAVE_STRDUP
> char *strdup(char *s)
> {
> 	char *retval;
> 
> 	retval = (char *) malloc(strlen(s)+1);
> 	if ( retval == NULL ) {
> 		perror("boa: out of memory in strdup");
> 		exit(1);
> 	}
> 	return strcpy(retval, s);
> }
> #endif
> 
> 
> /*
305a343,346
> #ifndef HAVE_GETCWD
> 	perror("boa: getcwd() not defined. Aborting.");
> 	exit(1);
> #endif
