\lcont{
-The web server runs until \cw{agedu} receives an end-of-file event
-on its standard input. (The expected usage is that you run it from
-the command line, immediately browse web pages until you're
-satisfied, and then press Ctrl-D.)
+The web server runs until \cw{agedu} receives an end-of-file event on
+its standard input. (The expected usage is that you run it from the
+command line, immediately browse web pages until you're satisfied, and
+then press Ctrl-D.) To disable the EOF behaviour, use the
+\cw{--no-eof} option.
In case the index file contains any confidential information about
your file system, the web server protects the pages it serves from
password, followed \e{immediately} by end of file (no trailing
newline, or else it will be considered part of the password).
+\dt \cw{--no-eof}
+
+\dd Stop \cw{agedu} in web server mode from looking for end-of-file on
+standard input and treating it as a signal to terminate.
+
\U LIMITATIONS
The data file is pretty large. The core of \cw{agedu} is the
HELPOPT("[--scan,--load] keep real atimes on directories") \
NOVAL(NODIRATIME) LONG(no_dir_atime) LONG(no_dir_atimes) \
HELPOPT("[--scan,--load] fake atimes on directories") \
+ NOVAL(NOEOF) LONG(no_eof) LONG(noeof) \
+ HELPOPT("[--web] do not close web server on EOF") \
NOVAL(MTIME) LONG(mtime) \
HELPOPT("[--scan] use mtime instead of atime") \
NOVAL(SHOWFILES) LONG(files) \
int depth = -1, gotdepth = 0;
int fakediratimes = 1;
int mtime = 0;
+ int closeoneof = 1;
int showfiles = 0;
#ifdef DEBUG_MAD_OPTION_PARSING_MACROS
case OPT_MTIME:
mtime = 1;
break;
+ case OPT_NOEOF:
+ closeoneof = 0;
+ break;
case OPT_DATAFILE:
filename = optval;
break;
dcfg.address = httpserveraddr;
dcfg.port = httpserverport;
+ dcfg.closeoneof = closeoneof;
dcfg.basicauthdata = httpauthdata;
pcfg.format = NULL;
pcfg.rootpage = NULL;
printf("URL: http://%s:%d/\n",
inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
}
+ fflush(stdout);
/*
* Now construct an fd structure to hold it.
*/
new_fdstruct(fd, FD_LISTENER);
- /*
- * Read from standard input, and treat EOF as a notification
- * to exit.
- */
- new_fdstruct(0, FD_CLIENT);
+ if (dcfg->closeoneof) {
+ /*
+ * Read from standard input, and treat EOF as a notification
+ * to exit.
+ */
+ new_fdstruct(0, FD_CLIENT);
+ }
/*
* Now we're ready to run our main loop. Keep looping round on
struct httpd_config {
const char *address;
int port;
+ int closeoneof;
const char *basicauthdata;
};